mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 14:54:37 +00:00
## 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](f58365b20b/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 <github-actions@github.com>