Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/network-modification-tree-pane.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 20 additions & 2 deletions src/components/study-container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { PARAMS_LOADED } from '../utils/config-params';
import {
closeStudy,
loadNetworkModificationTreeSuccess,
networkModificationTreeNodesUpdated,
openStudy,
resetEquipmentsPostComputation,
setCurrentRootNetworkUuid,
Expand All @@ -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';

Expand Down Expand Up @@ -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 });
Expand Down
Loading