Comfy-Org / Comfy-Org/ComfyUI_frontend
bug: Reroute pos setter silently drops writes before materializeRerouteLayout
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 704
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 512
Description
## Bug
In `src/lib/litegraph/src/Reroute.ts:960–965`, the `pos` setter calls `moveRerouteLayout(this, ...)`, which looks up `rerouteAttachments.get(reroute)`. If `pos` is set on a Reroute that was constructed but not yet added to a graph (e.g. during deserialization or subgraph wiring), the attachment is absent and the write is silently dropped.
The old code called `createReroute` in the constructor so the store always had an entry. Pre-attachment position writes are now lost with no warning.
Additionally, `materializeRerouteLayout` has no pre-check: if a store entry already exists, the supplied initial position is silently ignored and the reroute's in-memory array is out of sync until `syncPosition()` is called.
## Impact
Reroute positions set during deserialization may be silently lost, causing reroutes to render at stale/incorrect positions.
## Fix
Either buffer `pos` writes until `materializeRerouteLayout` runs, or document that pre-attachment writes are intentionally local-only and audit all deserialization call sites. In `materializeRerouteLayout`, when a store entry already exists, call `reroute.syncPosition()` to reconcile (mirror the `adoptNodeAttachment` pattern).
_Filed as follow-up from review of #15017 (merged 2026-08-14)._
Contributor guide
Assessment
This issue has not been assessed yet.