Skip to content
Snippets Groups Projects
Commit bb5c9147 authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

TMSS-2831: handle updates on items that moved into wekkview scope

parent 7ae5f6d7
No related branches found
No related tags found
1 merge request!1210Resolve TMSS-2831
...@@ -274,7 +274,7 @@ export default function WeekView() { ...@@ -274,7 +274,7 @@ export default function WeekView() {
console.log("Auth token submitted"); console.log("Auth token submitted");
} }
} catch (err) { } catch (err) {
console.log('err', err) console.log('err', err);
} }
} }
...@@ -282,7 +282,7 @@ export default function WeekView() { ...@@ -282,7 +282,7 @@ export default function WeekView() {
* Function to call when websocket is disconnected * Function to call when websocket is disconnected
*/ */
function onDisconnect() { function onDisconnect() {
console.log("WS Closed") console.log("WS Closed");
} }
function fetchBlueprintAndAddToTimeline(id) { function fetchBlueprintAndAddToTimeline(id) {
...@@ -293,7 +293,8 @@ export default function WeekView() { ...@@ -293,7 +293,8 @@ export default function WeekView() {
...prevData, ...prevData,
schedulingUnits: prevData.schedulingUnits.concat(response) schedulingUnits: prevData.schedulingUnits.concat(response)
})); }));
}); })
.catch(e => console.error("Couldn't retrieve scheduling unit details for id: ", id, e));
} }
/** /**
...@@ -318,7 +319,7 @@ export default function WeekView() { ...@@ -318,7 +319,7 @@ export default function WeekView() {
break; break;
} }
case 'update': { case 'update': {
if (data.schedulingUnits.schedulingUnits.some(unit => unit.id === jsonData.object_details.id)) { if (data.schedulingUnits.some(unit => unit.id === jsonData.object_details.id)) {
// usually we already have most details, so only update the relevant ones. // usually we already have most details, so only update the relevant ones.
setData(prevData => ({ setData(prevData => ({
...prevData, ...prevData,
...@@ -330,7 +331,7 @@ export default function WeekView() { ...@@ -330,7 +331,7 @@ export default function WeekView() {
// ...but sometimes we don't have the details yet, e.g. because it at least used to be // ...but sometimes we don't have the details yet, e.g. because it at least used to be
// outside the timelines time range, and we need to fetch all details so we don't miss // outside the timelines time range, and we need to fetch all details so we don't miss
// anything that e.g. got moved into scope. // anything that e.g. got moved into scope.
fetchBlueprintAndAddToTimeline(jsonData.object_details.id) fetchBlueprintAndAddToTimeline(jsonData.object_details.id);
} }
if (summaryItem?.id === jsonData.object_details.id) { if (summaryItem?.id === jsonData.object_details.id) {
...@@ -350,7 +351,7 @@ export default function WeekView() { ...@@ -350,7 +351,7 @@ export default function WeekView() {
break; break;
} }
case 'create': { case 'create': {
fetchBlueprintAndAddToTimeline(jsonData.object_details.id) fetchBlueprintAndAddToTimeline(jsonData.object_details.id);
break; break;
} }
default: { break; } default: { break; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment