Skip to content

Commit

Permalink
Merge pull request #5156 from systeminit/fix/BUG-715-view-initializat…
Browse files Browse the repository at this point in the history
…ion-problems

BUG-715: Fix to view initialization that causes missing view nodes and old component nodes
  • Loading branch information
jobelenus authored Dec 18, 2024
2 parents 76fa042 + c4b967d commit 47f07c7
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 47f07c7

Please sign in to comment.