Skip to content

Commit 8936212

Browse files
simula-rgithub-actions
andauthored
fix: node deletion handling in vue nodes when switching from litegrap… (#5909)
## Summary Fix node deletion when switching from litegraph -> vue node mode. ## Background: There is a race condition where we have [2 watch() functions that are both tracking shouldRenderVueNodes.value](https://github.com/Comfy-Org/ComfyUI_frontend/blob/f58365b20b2eb768f0db21eafa29d32291e064fb/src/composables/graph/useVueNodeLifecycle.ts#L85): - For vue node lifecycle - For slot/link sync lifecycle Each watch() separately sets graph.onNodeRemoved to its own cleanup handler. But without flush: 'sync', the slot sync watch runs AFTER vue nodes and overwrites the callback. So when deletion happens, graph.onNodeRemoved points to the slot handler (or undefined) instead of the vue cleanup handler, and the vue node never gets removed from the DOM. ## Review Focus We are making use of the watch() option "fush: sync" in the link and slot watch() so maybe there is side effects from firing this when dependencies change synchronously. ## Screenshots (if applicable) https://github.com/user-attachments/assets/6951fa50-61d5-4c63-88e9-e113f603ff77 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5909-fix-node-deletion-handling-in-vue-nodes-when-switching-from-litegrap-2826d73d365081bdba35c3d8728d6251) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <[email protected]>
1 parent 338cbd4 commit 8936212

File tree

3 files changed

+1
-1
lines changed

3 files changed

+1
-1
lines changed
-1.34 KB
Loading
-2.86 KB
Loading

src/composables/graph/useVueNodeLifecycle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function useVueNodeLifecycleIndividual() {
116116
slotSyncManager.attemptStart(canvas as LGraphCanvas)
117117
}
118118
},
119-
{ immediate: true }
119+
{ immediate: true, flush: 'sync' }
120120
)
121121

122122
// Handle case where Vue nodes are enabled but graph starts empty

0 commit comments

Comments
 (0)