Skip to content

Commit

Permalink
BUG-715: Fix to view initialization that causes missing view nodes an…
Browse files Browse the repository at this point in the history
…d old component nodes
  • Loading branch information
jobelenus committed Dec 18, 2024
1 parent 76fa042 commit c4b967d
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions app/web/src/store/views.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,22 +670,32 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
viewId: ViewId;
name: string;
components: Record<ComponentId, Vector2d & Partial<Size2D>>;
views: Record<ViewId, Vector2d & Size2D>;
}>({
method: "get",
url: API_PREFIX.concat([{ viewId }, "get_geometry"]),
onSuccess: (response) => {
let view = this.viewsById[viewId];
if (!view) {
view = {
id: response.viewId,
name: response.name,
components: {},
groups: {},
sockets: {},
viewNodes: {},
};
this.viewsById[response.viewId] = view;
}
const view: View = {
id: response.viewId,
name: response.name,
components: {},
groups: {},
sockets: {},
viewNodes: {},
};
this.viewsById[response.viewId] = view;

Object.entries(response.views).forEach(([viewId, geo]) => {
const v = this.viewList.find((_v) => _v.id === viewId);
if (!v) return;

view.viewNodes[v.id] = new DiagramViewData({
...v,
...VIEW_DEFAULTS,
...geo,
componentType: ComponentType.View,
});
});

Object.entries(response.components).forEach(
([componentId, geo]) => {
Expand Down

0 comments on commit c4b967d

Please sign in to comment.