From 4634650beaeadd08d7a8531d3f076098fc80c085 Mon Sep 17 00:00:00 2001 From: Ayoub LABIDI Date: Tue, 25 Nov 2025 18:38:04 +0100 Subject: [PATCH] Fix node status synchronization Signed-off-by: Ayoub LABIDI --- .../network-modification-tree-pane.jsx | 4 +++- src/components/study-container.jsx | 22 +++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/components/network-modification-tree-pane.jsx b/src/components/network-modification-tree-pane.jsx index 083f9f21a6..86856f3d71 100644 --- a/src/components/network-modification-tree-pane.jsx +++ b/src/components/network-modification-tree-pane.jsx @@ -311,7 +311,9 @@ export const NetworkModificationTreePane = ({ studyUuid, currentRootNetworkUuid studyUpdatedForce.eventData.headers.updateType === NotificationType.NODE_BUILD_STATUS_UPDATED && studyUpdatedForce.eventData.headers.rootNetworkUuid === currentRootNetworkUuidRef.current ) { - updateNodes(studyUpdatedForce.eventData.headers.nodes); + // Note: The actual node updates are now handled globally in study-container.jsx + // to ensure all workspaces open in other browser tabs (including those without tree panel) stay synchronized. + // Here we only handle tree-specific cleanup operations. if (studyUpdatedForce.eventData.headers.nodes.some((nodeId) => nodeId === currentNodeRef.current?.id)) { dispatch(removeNotificationByNode([currentNodeRef.current?.id])); // when the current node is updated, we need to reset the logs filter diff --git a/src/components/study-container.jsx b/src/components/study-container.jsx index c4b32fa731..eac11f4137 100644 --- a/src/components/study-container.jsx +++ b/src/components/study-container.jsx @@ -13,6 +13,7 @@ import { PARAMS_LOADED } from '../utils/config-params'; import { closeStudy, loadNetworkModificationTreeSuccess, + networkModificationTreeNodesUpdated, openStudy, resetEquipmentsPostComputation, setCurrentRootNetworkUuid, @@ -37,7 +38,7 @@ import NetworkModificationTreeModel from './graph/network-modification-tree-mode import { getFirstNodeOfType } from './graph/util/model-functions'; import { BUILD_STATUS } from './network/constants'; import { useAllComputingStatus } from './computing-status/use-all-computing-status'; -import { fetchNetworkModificationTree } from '../services/study/tree-subtree'; +import { fetchNetworkModificationTree, fetchNetworkModificationTreeNode } from '../services/study/tree-subtree'; import { fetchNetworkExistence, fetchRootNetworkIndexationStatus } from '../services/study/network'; import { fetchStudy, recreateStudyNetwork, reindexAllRootNetwork } from 'services/study/study'; @@ -271,9 +272,26 @@ export function StudyContainer() { } displayErrorNotifications(eventData); dispatch(studyUpdated(eventData)); + + // Handle build status updates globally so all workspaces open in other browser tabs update currentTreeNode + // This fixes the issue where tabs without tree panel don't get updates + if ( + updateTypeHeader === NotificationType.NODE_BUILD_STATUS_UPDATED && + eventData.headers.rootNetworkUuid === currentRootNetworkUuidRef.current + ) { + // Fetch updated nodes and dispatch to Redux to sync currentTreeNode + const updatedNodeIds = eventData.headers.nodes; + Promise.all( + updatedNodeIds.map((nodeId) => + fetchNetworkModificationTreeNode(studyUuid, nodeId, currentRootNetworkUuidRef.current) + ) + ).then((values) => { + dispatch(networkModificationTreeNodesUpdated(values)); + }); + } }, // Note: dispatch doesn't change - [dispatch, displayErrorNotifications, sendAlert] + [dispatch, displayErrorNotifications, sendAlert, studyUuid] ); useNotificationsListener(NotificationsUrlKeys.STUDY, { listenerCallbackMessage: handleStudyUpdate });