Prevent configuring a node to a placeholder nodeId#8342
Conversation
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 01/28/2026, 02:52:52 AM UTC 🔗 Links🎉 Your Storybook is ready for review! |
🎭 Playwright Tests:
|
📝 WalkthroughWalkthroughAdds a guard in LGraphNode.configure to ignore a serialized id of -1 (preserving the existing node id) and a test verifying that deserializing a node with Changes
Suggested reviewers
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 23.6 kB (baseline 23.6 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 961 kB (baseline 961 kB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 80.7 kB (baseline 80.7 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 9 added / 9 removed Panels & Settings — 470 kB (baseline 470 kB) • 🟢 -8 BConfiguration panels, inspectors, and settings screens
Status: 12 added / 12 removed User & Accounts — 3.94 kB (baseline 3.94 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 3 added / 3 removed Editors & Dialogs — 2.9 kB (baseline 2.9 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 2 added / 2 removed UI Components — 33.7 kB (baseline 33.7 kB) • ⚪ 0 BReusable component library chunks
Status: 4 added / 4 removed Data & Services — 2.71 MB (baseline 2.7 MB) • 🔴 +42 BStores, services, APIs, and repositories
Status: 9 added / 9 removed Utilities & Hooks — 25.5 kB (baseline 25.5 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 7 added / 7 removed Vendor & Third-Party — 10.7 MB (baseline 10.7 MB) • ⚪ 0 BExternal libraries and shared vendor chunks
Other — 7.04 MB (baseline 7.04 MB) • 🟢 -200 BBundles that do not match a named category
Status: 37 added / 37 removed |
src/lib/litegraph/src/LGraphNode.ts
Outdated
| if (this.graph) { | ||
| this.graph._version++ | ||
| } | ||
| if (info.id == -1) info.id = this.id |
There was a problem hiding this comment.
Nit:
| if (info.id == -1) info.id = this.id | |
| if (info.id === -1) info.id = this.id |
There was a problem hiding this comment.
Loose equality was intentional. NodeId can be a number or a string and an id of '-1' would be equally problematic.
Would appreciate a second opinion though. LGraph.add() does use strict equality to -1 when a node is added to the graph 🤔
Litegraph uses
-1as a placeholder node id to indicate that a node should be assigned a new node id when added to the graph. Under some unknown circumstances it's possible for a node to have this placeholder id saved in a workflow file.When this occurs, the node is loaded and assigned a new id, but then configured back to the placeholder id. This PR makes it so the newly assigned id is kept instead.
┆Issue is synchronized with this Notion page by Unito