Comfy-Org / Comfy-Org/ComfyUI_frontend
bug: adoptExisting path silently discards canonical store geometry in graphLayoutAttachment
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Bug
In `src/renderer/core/layout/operations/graphLayoutAttachment.ts:367–373`, `attachNodeLayout` calls `detachNodeLayout(node)` when a prior attachment exists, issuing a `deleteNode` to the store. In the `adoptExisting` scenario, the preceding `detachNodeLayout` already wiped the entry. The subsequent `layoutStore.getNodeLayout(...)` check is now false, so `adoptNodeAttachment` is skipped and a fresh `createNode` is issued from `node._pos`/`_size` — silently discarding whatever canonical geometry was stored.
## Impact
Node geometry reverts to local `_pos`/`_size` values instead of the stored canonical geometry when a node is re-attached to the same graph.
## Fix
Read and cache any pre-existing layout entry BEFORE calling `detachNodeLayout`. After detach, either restore via the cache or bypass the delete when re-attaching to the same graph. Minimum viable: if `nodeAttachments.get(node)?.graphId === graphId`, call `adoptNodeAttachment` directly without delete-then-create.
_Filed as follow-up from review of #15017 (merged 2026-08-14)._
Contributor guide
Assessment
This issue has not been assessed yet.