Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: missing new edges on apply #5181

Merged
merged 1 commit into from
Dec 20, 2024
Merged
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
40 changes: 19 additions & 21 deletions app/web/src/store/views.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,23 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
this.selectedComponentIds = valid;
this.syncSelectionIntoUrl();
},
viewAssignment(view: View) {
/* *
* i think i want to set these as in-memory references
* that way i don't have to do two writes for incoming WsEvents
* or two writes for user actions
*
* this does mean that `draggedElementsPositionsPreDrag` and
* `resizedElementSizesPreResize` need to be populated
* but those could just be a `structuredClone` of this data
* */
this.components = view.components;
this.groups = view.groups;
this.viewNodes = view.viewNodes;
// derive the socket position from the component position
// to begin, and then adjust it via delta when things move
this.sockets = view.sockets;
},
async selectView(id: ViewId) {
const view = this.viewsById[id];
if (view) {
Expand All @@ -620,22 +637,8 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
this.selectedViewId = id;
this.outlinerViewId = id;
this._enforceSelectedComponents();
/* *
* i think i want to set these as in-memory references
* that way i don't have to do two writes for incoming WsEvents
* or two writes for user actions
*
* this does mean that `draggedElementsPositionsPreDrag` and
* `resizedElementSizesPreResize` need to be populated
* but those could just be a `structuredClone` of this data
* */
this.components = view.components;
this.groups = view.groups;
this.viewNodes = view.viewNodes;
this.setGroupZIndex();
// derive the socket position from the component position
// to begin, and then adjust it via delta when things move
this.sockets = view.sockets;
this.viewAssignment(view);
} else {
const res = await this.FETCH_VIEW(id);
if (!res.result.success) {
Expand Down Expand Up @@ -734,12 +737,7 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
},
);
this.setGroupZIndex();

if (this.selectedViewId === view.id) {
this.components = view.components;
this.groups = view.groups;
this.viewNodes = view.viewNodes;
}
if (this.selectedViewId === view.id) this.viewAssignment(view);
},
});
},
Expand Down
Loading