Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ import {
isModificationsDeleteFinishedNotification,
isModificationsUpdateFinishedNotification,
isNodeDeletedNotification,
isSharedElementUpdateNotification,
parseEventData,
} from 'types/notification-types';
import { LccModificationDialog } from '../../../dialogs/network-modifications/hvdc-line/lcc/modification/lcc-modification-dialog';
Expand Down Expand Up @@ -802,6 +803,19 @@ const NetworkModificationNodeEditor = () => {
}
dofetchNetworkModifications();
}

// a shared (referenced) composite modification pointed at by this node was edited
// elsewhere. Re-fetching the group hands NetworkModificationsTable a fresh
// `modifications` identity, which makes it force-refresh the resolved content of every
// expanded composite / reference row (fetchSubModificationsForExpandedRows(..., force));
// a collapsed reference reloads its content the next time it is expanded.
if (isSharedElementUpdateNotification(eventData)) {
if (currentNodeIdRef.current !== eventData.headers.parentNode) {
return;
}
dofetchNetworkModifications();
dofetchExcludedNetworkModifications();
}
},
[dofetchNetworkModifications, cleanClipboard, dofetchExcludedNetworkModifications]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
isNodeEditedNotification,
isNodeSubTreeCreatedNotification,
isRootNetworksUpdatedNotification,
isSharedElementUpdateNotification,
} from 'types/notification-types';

type UseRootNetworkNotificationsProps = {
Expand All @@ -39,7 +40,8 @@ export const useRootNetworkSearchNotifications = ({
const rootNetworksStatus = isRootNetworksUpdatedNotification(eventData);
const networkModificationsStatus =
isModificationsDeleteFinishedNotification(eventData) ||
isModificationsUpdateFinishedNotification(eventData);
isModificationsUpdateFinishedNotification(eventData) ||
isSharedElementUpdateNotification(eventData);
const nodeDeleted = isNodeDeletedNotification(eventData);
const nodeCreated = isNodeCreatedNotification(eventData);
const nodeEdited = isNodeEditedNotification(eventData);
Expand Down
16 changes: 16 additions & 0 deletions src/types/notification-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export enum NotificationType {
// Modifications
MODIFICATIONS_UPDATE_FINISHED = 'UPDATE_FINISHED',
MODIFICATIONS_DELETE_FINISHED = 'DELETE_FINISHED',
SHARED_ELEMENT_UPDATE = 'sharedElementUpdate',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UPDATE_SHARED_ELEMENT ?

// Events
EVENT_CRUD_FINISHED = 'EVENT_CRUD_FINISHED',

Expand Down Expand Up @@ -279,6 +280,12 @@ interface ModificationsDeleteFinishedEventDataHeaders extends CommonStudyEventDa
nodes: UUID[];
}

interface SharedElementUpdateEventDataHeaders extends CommonStudyEventDataHeaders {
updateType: NotificationType.SHARED_ELEMENT_UPDATE;
parentNode: UUID;
networkModificationUuids?: UUID[];
}

interface EventCrudFinishedEventDataHeaders extends CommonStudyEventDataHeaders {
updateType: NotificationType.EVENT_CRUD_FINISHED;
parentNode: UUID;
Expand Down Expand Up @@ -484,6 +491,11 @@ export interface ModificationsUpdateFinishedEventData extends CommonStudyEventDa
payload: undefined;
}

export interface SharedElementUpdateEventData extends CommonStudyEventData {
headers: SharedElementUpdateEventDataHeaders;
payload: undefined;
}

export interface ModificationsDeleteFinishedEventData extends CommonStudyEventData {
headers: ModificationsDeleteFinishedEventDataHeaders;
payload: undefined;
Expand Down Expand Up @@ -674,6 +686,10 @@ export function isModificationsDeleteFinishedNotification(
return notif.headers?.updateType === NotificationType.MODIFICATIONS_DELETE_FINISHED;
}

export function isSharedElementUpdateNotification(notif: CommonStudyEventData): notif is SharedElementUpdateEventData {
return notif.headers?.updateType === NotificationType.SHARED_ELEMENT_UPDATE;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a notification from study server !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notification is emitted by study‑server, not directory‑server

}

export function isIndexationStatusNotification(notif: CommonStudyEventData): notif is IndexationStatusEventData {
return notif.headers?.updateType === NotificationType.INDEXATION_STATUS;
}
Expand Down
Loading