Repository navigation
refactor!: make nodeDataStore the source of truth for node shell state - #13963
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 1693 passed, 0 failed · 2 flaky📊 Browser Reports
📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-07-28T23:01:49.635Z",
"gitSha": "f6e1b620e96b9987bcac56e8657004e034de2c6e",
"branch": "drjkl/node-data-store",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2077.150999999958,
"styleRecalcs": 4,
"styleRecalcDurationMs": 4.154000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 438.429,
"heapDeltaBytes": 13771952,
"heapUsedBytes": 66306156,
"domNodes": -278,
"jsHeapTotalBytes": 15855616,
"scriptDurationMs": 26.307000000000002,
"eventListeners": -201,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-idle",
"durationMs": 2047.3200000000134,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.562999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 427.7320000000001,
"heapDeltaBytes": -1402888,
"heapUsedBytes": 50487508,
"domNodes": -286,
"jsHeapTotalBytes": 16904192,
"scriptDurationMs": 25.089,
"eventListeners": -203,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1841.540000000009,
"styleRecalcs": 74,
"styleRecalcDurationMs": 38.766000000000005,
"layouts": 12,
"layoutDurationMs": 5.461,
"taskDurationMs": 839.5250000000001,
"heapDeltaBytes": -2833448,
"heapUsedBytes": 56732788,
"domNodes": 58,
"jsHeapTotalBytes": 26214400,
"scriptDurationMs": 171.52599999999998,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1809.8899999999958,
"styleRecalcs": 74,
"styleRecalcDurationMs": 36.7,
"layouts": 12,
"layoutDurationMs": 3.5190000000000006,
"taskDurationMs": 813.218,
"heapDeltaBytes": -2950732,
"heapUsedBytes": 56542012,
"domNodes": 56,
"jsHeapTotalBytes": 25165824,
"scriptDurationMs": 173.498,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1773.6530000000243,
"styleRecalcs": 29,
"styleRecalcDurationMs": 16.948999999999998,
"layouts": 6,
"layoutDurationMs": 0.6330000000000001,
"taskDurationMs": 398.386,
"heapDeltaBytes": -3350536,
"heapUsedBytes": 67027048,
"domNodes": -226,
"jsHeapTotalBytes": 12734464,
"scriptDurationMs": 27.834999999999997,
"eventListeners": -188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1741.4430000000038,
"styleRecalcs": 31,
"styleRecalcDurationMs": 19.110000000000003,
"layouts": 6,
"layoutDurationMs": 0.7110000000000001,
"taskDurationMs": 380.244,
"heapDeltaBytes": -3405060,
"heapUsedBytes": 67166380,
"domNodes": -220,
"jsHeapTotalBytes": 12996608,
"scriptDurationMs": 26.925000000000004,
"eventListeners": -188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 561.2980000000221,
"styleRecalcs": 12,
"styleRecalcDurationMs": 9.280000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 386.86299999999994,
"heapDeltaBytes": -10914732,
"heapUsedBytes": 55811852,
"domNodes": 20,
"jsHeapTotalBytes": 20733952,
"scriptDurationMs": 87.15799999999999,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "dom-widget-clipping",
"durationMs": 616.359999999986,
"styleRecalcs": 12,
"styleRecalcDurationMs": 12.074,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 418.67900000000003,
"heapDeltaBytes": -21193496,
"heapUsedBytes": 49438040,
"domNodes": -271,
"jsHeapTotalBytes": 6180864,
"scriptDurationMs": 86.973,
"eventListeners": -207,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2014.848000000029,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.669999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 715.7370000000001,
"heapDeltaBytes": -16087764,
"heapUsedBytes": 60723088,
"domNodes": 18,
"jsHeapTotalBytes": 6410240,
"scriptDurationMs": 243.60399999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2056.447999999932,
"styleRecalcs": 7,
"styleRecalcDurationMs": 6.7860000000000005,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 699.4789999999999,
"heapDeltaBytes": -15996072,
"heapUsedBytes": 56989500,
"domNodes": -273,
"jsHeapTotalBytes": -1843200,
"scriptDurationMs": 245.32999999999998,
"eventListeners": -201,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-pan",
"durationMs": 2260.9789999999634,
"styleRecalcs": 66,
"styleRecalcDurationMs": 14.853000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1623.978,
"heapDeltaBytes": 32068940,
"heapUsedBytes": 85327348,
"domNodes": -278,
"jsHeapTotalBytes": 1515520,
"scriptDurationMs": 944.773,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2306.6390000000183,
"styleRecalcs": 68,
"styleRecalcDurationMs": 16.397,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1672.306,
"heapDeltaBytes": 11823704,
"heapUsedBytes": 86165128,
"domNodes": -273,
"jsHeapTotalBytes": 720896,
"scriptDurationMs": 960.2499999999999,
"eventListeners": -205,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3636.693999999977,
"styleRecalcs": 62,
"styleRecalcDurationMs": 15.812999999999997,
"layouts": 60,
"layoutDurationMs": 7.726,
"taskDurationMs": 1879.5949999999998,
"heapDeltaBytes": 25490628,
"heapUsedBytes": 79893676,
"domNodes": -281,
"jsHeapTotalBytes": 1310720,
"scriptDurationMs": 1068.96,
"eventListeners": -199,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3643.2629999999335,
"styleRecalcs": 61,
"styleRecalcDurationMs": 14.580999999999996,
"layouts": 60,
"layoutDurationMs": 7.5649999999999995,
"taskDurationMs": 1864.5299999999997,
"heapDeltaBytes": 5413572,
"heapUsedBytes": 60565400,
"domNodes": -285,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 1061.5800000000002,
"eventListeners": 10,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2028.8029999999821,
"styleRecalcs": 5,
"styleRecalcDurationMs": 4.543000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 693.368,
"heapDeltaBytes": -18123380,
"heapUsedBytes": 57330320,
"domNodes": -276,
"jsHeapTotalBytes": -1318912,
"scriptDurationMs": 245.145,
"eventListeners": -201,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 1993.614999999977,
"styleRecalcs": 8,
"styleRecalcDurationMs": 8.228000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 676.3389999999999,
"heapDeltaBytes": 9237524,
"heapUsedBytes": 76842984,
"domNodes": 16,
"jsHeapTotalBytes": 6348800,
"scriptDurationMs": 242.90099999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 644.6640000000343,
"styleRecalcs": 47,
"styleRecalcDurationMs": 13.384,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 446.7,
"heapDeltaBytes": -21046764,
"heapUsedBytes": 49386192,
"domNodes": -271,
"jsHeapTotalBytes": 5656576,
"scriptDurationMs": 157.835,
"eventListeners": -201,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 622.6990000000114,
"styleRecalcs": 46,
"styleRecalcDurationMs": 13.04,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 455.79900000000004,
"heapDeltaBytes": -21172704,
"heapUsedBytes": 49412944,
"domNodes": -275,
"jsHeapTotalBytes": 5918720,
"scriptDurationMs": 163.66400000000002,
"eventListeners": -201,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2040.6580000000076,
"styleRecalcs": 11,
"styleRecalcDurationMs": 10.328000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 445.089,
"heapDeltaBytes": -7385496,
"heapUsedBytes": 63153504,
"domNodes": -268,
"jsHeapTotalBytes": 19288064,
"scriptDurationMs": 20.217,
"eventListeners": -203,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2024.5720000000347,
"styleRecalcs": 10,
"styleRecalcDurationMs": 10.113999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 421.7730000000001,
"heapDeltaBytes": -7793980,
"heapUsedBytes": 62785416,
"domNodes": -272,
"jsHeapTotalBytes": 19550208,
"scriptDurationMs": 18.211000000000006,
"eventListeners": -203,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1699.0339999999833,
"styleRecalcs": 75,
"styleRecalcDurationMs": 34.864999999999995,
"layouts": 16,
"layoutDurationMs": 4.032,
"taskDurationMs": 709.029,
"heapDeltaBytes": -9013840,
"heapUsedBytes": 50441232,
"domNodes": 63,
"jsHeapTotalBytes": 24641536,
"scriptDurationMs": 113.49399999999999,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1759.2860000000883,
"styleRecalcs": 79,
"styleRecalcDurationMs": 43.169,
"layouts": 16,
"layoutDurationMs": 4.5249999999999995,
"taskDurationMs": 796.439,
"heapDeltaBytes": -15772216,
"heapUsedBytes": 54892608,
"domNodes": -196,
"jsHeapTotalBytes": 20074496,
"scriptDurationMs": 120.9,
"eventListeners": -203,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 999.6479999999792,
"styleRecalcs": 7,
"styleRecalcDurationMs": 26.937999999999988,
"layouts": 4,
"layoutDurationMs": 12.073,
"taskDurationMs": 814.0340000000001,
"heapDeltaBytes": 14366040,
"heapUsedBytes": 97904760,
"domNodes": 13134,
"jsHeapTotalBytes": 19922944,
"scriptDurationMs": 39.501999999999995,
"eventListeners": 1660,
"totalBlockingTimeMs": 164,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "viewport-pan-sweep",
"durationMs": 8381.804000000046,
"styleRecalcs": 251,
"styleRecalcDurationMs": 53.687999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5780.211,
"heapDeltaBytes": 2020916,
"heapUsedBytes": 75096936,
"domNodes": -267,
"jsHeapTotalBytes": 1245184,
"scriptDurationMs": 3163.434,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8461.203999999952,
"styleRecalcs": 251,
"styleRecalcDurationMs": 54.631,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5922.482000000001,
"heapDeltaBytes": -6071512,
"heapUsedBytes": 75489836,
"domNodes": -266,
"jsHeapTotalBytes": 806912,
"scriptDurationMs": 3275.4539999999997,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 12963.030000000002,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12946.435000000001,
"heapDeltaBytes": -19196324,
"heapUsedBytes": 167810524,
"domNodes": -1536,
"jsHeapTotalBytes": 11272192,
"scriptDurationMs": 1025.7350000000001,
"eventListeners": -7450,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-idle",
"durationMs": 12911.888999999974,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12891.982000000002,
"heapDeltaBytes": -17011032,
"heapUsedBytes": 167339568,
"domNodes": -1536,
"jsHeapTotalBytes": -1077248,
"scriptDurationMs": 1094.7479999999998,
"eventListeners": -7460,
"totalBlockingTimeMs": 0,
"frameDurationMs": 18.329999999999927,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 15902.958000000013,
"styleRecalcs": 81,
"styleRecalcDurationMs": 19.852000000000036,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15880.979,
"heapDeltaBytes": -20754736,
"heapUsedBytes": 165723916,
"domNodes": -1536,
"jsHeapTotalBytes": 6553600,
"scriptDurationMs": 1604.241,
"eventListeners": -7446,
"totalBlockingTimeMs": 106,
"frameDurationMs": 17.223333333333237,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 15772.933999999965,
"styleRecalcs": 80,
"styleRecalcDurationMs": 18.108999999999988,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15750.142999999998,
"heapDeltaBytes": 1573028,
"heapUsedBytes": 181583544,
"domNodes": -1536,
"jsHeapTotalBytes": -638976,
"scriptDurationMs": 1484.712,
"eventListeners": -7454,
"totalBlockingTimeMs": 53,
"frameDurationMs": 17.779999999999927,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 523.5519999999951,
"styleRecalcs": 22,
"styleRecalcDurationMs": 26.556000000000004,
"layouts": 4,
"layoutDurationMs": 1.171,
"taskDurationMs": 216.56900000000002,
"heapDeltaBytes": -22159596,
"heapUsedBytes": 49205368,
"domNodes": -140,
"jsHeapTotalBytes": 5132288,
"scriptDurationMs": 19.341,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.663333333333338,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 527.9689999999846,
"styleRecalcs": 17,
"styleRecalcDurationMs": 26.120000000000005,
"layouts": 5,
"layoutDurationMs": 1.256,
"taskDurationMs": 202.544,
"heapDeltaBytes": -22187628,
"heapUsedBytes": 49220416,
"domNodes": -174,
"jsHeapTotalBytes": 4345856,
"scriptDurationMs": 17.773,
"eventListeners": -136,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
}
]
} |
ec1a75c to
643c7ed
Compare
a77bea6 to
2ff883d
Compare
643c7ed to
1c3c6fe
Compare
e4f3421 to
b180e6e
Compare
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## feature/ecs-migration #13963 +/- ##
========================================================
Coverage ? 66.26%
========================================================
Files ? 1568
Lines ? 79862
Branches ? 20813
========================================================
Hits ? 52920
Misses ? 26603
Partials ? 339
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 10
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/litegraph/src/LGraphNodeProperties.test.ts (1)
14-23: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUse a real
LGraphNodehere so the accessor path is covered.createMockLGraphNode()returns plain data properties, so these tests still exercise the fallback descriptor branch fortitle/modeinstead of_instrumentAccessor. Switch this suite to a real node instance or a helper that preserves the prototype accessors.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/litegraph/src/LGraphNodeProperties.test.ts` around lines 14 - 23, Update the test setup in the beforeEach block to construct a real LGraphNode, or use a helper that preserves LGraphNode’s prototype accessors, instead of createMockLGraphNode. Keep the existing test values and mockGraph assignment so title/mode access goes through _instrumentAccessor rather than the fallback descriptor branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/architecture/ecs-migration-plan.md`:
- Around line 117-127: The Phase 1 store-keying description must distinguish
stores using composite string IDs from graph-scoped stores such as
nodeDataStore. Update the relevant prose to accurately state that nodeDataStore
uses NodeId keys within root-graph-scoped buckets, while preserving the existing
composite-key description for applicable stores.
In `@src/composables/graph/useErrorClearingHooks.ts`:
- Around line 50-51: The NodeLifecycleEvent payload type is duplicated and
should be centralized. Export a shared NodeLifecycleEvent type alongside the
event map definitions in LGraphEventMap.ts, then remove the local aliases and
import the shared type in src/composables/graph/useErrorClearingHooks.ts (lines
50-51) and src/composables/graph/useVueNodeLifecycle.ts (line 17).
In `@src/composables/graph/useVueNodeLifecycle.test.ts`:
- Around line 8-9: Fix test isolation in useVueNodeLifecycle.test.ts by making
the shouldRenderVueNodes and canvas mocks reactive with ref or shallowRef, and
ensure each test receives a fresh createSharedComposable instance by resetting
modules and re-importing the composable per test when needed. Update the
affected tests so initialization and disposal operate on each test’s own graph,
preserving assertions that specifically verify listeners stop seeding after
dispose.
In `@src/lib/litegraph/src/LGraphNode.ts`:
- Around line 1008-1012: Update the type-specific branch in configure() to apply
the same null/missing-value guard as the general property loop before assigning
this._state.type. Preserve the constructor-assigned type when info.type is null
or undefined, and only convert and assign valid serialized type values.
- Around line 4363-4381: Move the node._state.graphId assignment in
registerNodeState until after store.registerNode succeeds, keeping the early
return untouched so refused nodes retain their original state. Preserve the
successful registration flow by assigning the graph ID before updating
node._graphId and registering slots.
In `@src/platform/nodeReplacement/useNodeReplacement.test.ts`:
- Around line 20-22: Update the tests around replaceWithMapping to assert the
registration handoff using the registerNodeState and unregisterNodeState mocks:
verify unregisterNodeState for the old id occurs before registerNodeState for
the replacement node’s id, while preserving the existing no-op stubs.
In `@src/renderer/extensions/minimap/data/LayoutStoreDataSource.ts`:
- Around line 55-61: Update LayoutStoreDataSource’s hasData() and getNodeCount()
to derive their results from the same renderable node set produced by
getNodes(), excluding registered states without layout entries. Avoid
independently rescanning or reallocating layout references for the count; reuse
a single computed node collection per change-check cycle so emptiness and count
remain consistent without duplicate work.
- Around line 47-49: Update the executionState lookup to first store or validate
the result of createNodeLocatorId(null, state.id), and only index
nodeProgressStates when that locator is non-null; otherwise preserve the null
fallback.
In `@src/renderer/extensions/minimap/data/MinimapDataSource.test.ts`:
- Around line 81-96: Replace the local graphNode helper in the minimap tests
with the shared createMockLGraphNode utility from litegraphTestUtils. Update the
test call sites and arguments as needed while preserving the existing node IDs,
positions, sizes, outputs, and other behavior, and remove the duplicated helper
definition.
In `@src/renderer/extensions/vueNodes/components/LGraphNode.vue`:
- Around line 49-53: Update the AppOutput visibility condition for the
output-node selection path to use the reactive hasAnyError computed value
instead of lgraphNode?.has_errors. Also review the related logic around
hasAnyError so all error-dependent visibility checks consistently use that
computed state and clear reactively.
---
Outside diff comments:
In `@src/lib/litegraph/src/LGraphNodeProperties.test.ts`:
- Around line 14-23: Update the test setup in the beforeEach block to construct
a real LGraphNode, or use a helper that preserves LGraphNode’s prototype
accessors, instead of createMockLGraphNode. Keep the existing test values and
mockGraph assignment so title/mode access goes through _instrumentAccessor
rather than the fallback descriptor branch.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: e1ce3188-d06c-43c2-9884-350107d198f8
📒 Files selected for processing (87)
browser_tests/tests/propertiesPanel/errorsTabCloudMissingModels.spec.tsbrowser_tests/tests/propertiesPanel/errorsTabModeAware.spec.tsdocs/architecture/ecs-migration-plan.mddocs/architecture/node-badge-store.mddocs/architecture/node-data-store.mddocs/architecture/proto-ecs-stores.mdsrc/components/builder/AppModeWidgetList.vuesrc/components/graph/GraphCanvas.vuesrc/components/rightSidePanel/parameters/WidgetItem.test.tssrc/components/rightSidePanel/subgraph/SubgraphEditor.test.tssrc/composables/graph/useErrorClearingHooks.test.tssrc/composables/graph/useErrorClearingHooks.tssrc/composables/graph/useGraphNodeManager.test.tssrc/composables/graph/useGraphNodeManager.tssrc/composables/graph/useNodeErrorFlagSync.test.tssrc/composables/graph/useVueNodeLifecycle.test.tssrc/composables/graph/useVueNodeLifecycle.tssrc/core/graph/subgraph/migration/proxyWidgetMigration.test.tssrc/core/graph/subgraph/promotionUtils.test.tssrc/extensions/core/saveImageExtraOutput.test.tssrc/lib/litegraph/src/LGraph.test.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.cloneZIndex.test.tssrc/lib/litegraph/src/LGraphCanvas.ghost.test.tssrc/lib/litegraph/src/LGraphCanvas.groupSelection.test.tssrc/lib/litegraph/src/LGraphCanvas.slotHitDetection.test.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/lib/litegraph/src/LGraphNode.nodeState.test.tssrc/lib/litegraph/src/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraphNodeProperties.test.tssrc/lib/litegraph/src/LGraphNodeProperties.tssrc/lib/litegraph/src/LiteGraphGlobal.tssrc/lib/litegraph/src/infrastructure/LGraphEventMap.tssrc/lib/litegraph/src/litegraph.tssrc/lib/litegraph/src/node/NodeInputSlot.test.tssrc/lib/litegraph/src/node/NodeInputSlot.tssrc/lib/litegraph/src/node/NodeSlot.test.tssrc/lib/litegraph/src/node/NodeSlot.tssrc/lib/litegraph/src/node/slotLinks.tssrc/lib/litegraph/src/subgraph/ExecutableNodeDTO.test.tssrc/lib/litegraph/src/subgraph/SubgraphNode.tssrc/platform/missingMedia/missingMediaStore.tssrc/platform/nodeReplacement/useNodeReplacement.test.tssrc/platform/nodeReplacement/useNodeReplacement.tssrc/platform/telemetry/nodeAdded/installNodeAddedTelemetry.test.tssrc/platform/telemetry/nodeAdded/installNodeAddedTelemetry.tssrc/renderer/extensions/minimap/composables/useMinimap.test.tssrc/renderer/extensions/minimap/composables/useMinimapGraph.test.tssrc/renderer/extensions/minimap/composables/useMinimapGraph.tssrc/renderer/extensions/minimap/data/LayoutStoreDataSource.tssrc/renderer/extensions/minimap/data/MinimapDataSource.test.tssrc/renderer/extensions/minimap/data/MinimapDataSourceFactory.tssrc/renderer/extensions/vueNodes/components/LGraphNode.subgraph.test.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vuesrc/renderer/extensions/vueNodes/components/LGraphNodePreview.vuesrc/renderer/extensions/vueNodes/components/NodeContent.vuesrc/renderer/extensions/vueNodes/components/NodeHeader.test.tssrc/renderer/extensions/vueNodes/components/NodeHeader.vuesrc/renderer/extensions/vueNodes/components/NodeSlots.test.tssrc/renderer/extensions/vueNodes/components/NodeSlots.vuesrc/renderer/extensions/vueNodes/components/NodeWidgets.test.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/composables/useNodeEventHandlers.test.tssrc/renderer/extensions/vueNodes/composables/useNodeEventHandlers.tssrc/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.tssrc/renderer/extensions/vueNodes/composables/useNodePointerInteractions.tssrc/renderer/extensions/vueNodes/composables/usePartitionedBadges.test.tssrc/renderer/extensions/vueNodes/composables/usePartitionedBadges.tssrc/renderer/extensions/vueNodes/composables/useProcessedWidgets.test.tssrc/renderer/extensions/vueNodes/composables/useProcessedWidgets.tssrc/renderer/extensions/vueNodes/utils/__tests__/nodeDataUtils.test.tssrc/renderer/extensions/vueNodes/utils/nodeDataUtils.tssrc/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.test.tssrc/stores/appModeStore.test.tssrc/stores/linkStore.tssrc/stores/nodeDataStore.test.tssrc/stores/nodeDataStore.tssrc/stores/widgetValueStore.graphReactivity.test.tssrc/systems/badgeSystem.pricing.test.tssrc/systems/badgeSystem.test.tssrc/systems/badgeSystem.tssrc/types/nodeState.tssrc/utils/__tests__/litegraphTestUtils.tssrc/utils/graphTraversalUtil.tssrc/utils/searchAndReplace.test.ts
💤 Files with no reviewable changes (4)
- src/components/rightSidePanel/parameters/WidgetItem.test.ts
- src/composables/graph/useGraphNodeManager.ts
- src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.ts
- src/composables/graph/useGraphNodeManager.test.ts
Introduce a dedicated node shell-state store (nodeDataStore) holding one plain NodeState per node in root-graph-scoped buckets, and make LGraphNode adopt the store's reactive proxy as _state via the LLink/Reroute trio pattern. id/type/title/mode/flags/color/bgcolor/shape/resizable/showAdvanced become accessors over _state; LGraph add/remove/clear and subgraph teardown register/unregister/clear the store. LGraphNodeProperties instrumentation is redirected to write through _state instead of shadowing closures. Scalar getters read through a toRaw view (_stateRaw) so hot litegraph and legacy-canvas paths skip the reactive proxy trap; flags keeps the reactive proxy for nested-mutation tracking. Foundation only; the VueNodeData mirror and useGraphNodeManager sync logic are removed in a follow-up commit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the VueNodeData snapshot map and its node:property:changed sync handlers with direct consumption of the NodeState store proxy. GraphCanvas now sources nodes from nodeDataStore.getGraphNodesFor(rootGraphId, graphId); the prop-drilled components retype from VueNodeData to NodeState. Fields the store excludes migrate to their owners: hasErrors -> live node.has_errors, inputs/outputs -> live node (with the shallowReactive slot graft relocated into the slimmed useGraphNodeManager), subgraphId derived from graphId via subgraphIdFromGraphId. useGraphNodeManager keeps only the layout seeding, slot graft, and slot-label reprojection; extractVueNodeData, the vueNodeData map, syncWithGraph, and the property-sync handlers are gone. Node replacement registers/unregisters node state by hand since it bypasses graph.add. NodeSlots gains inputs/outputs override props for synthetic preview nodes with no live graph node. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the _stateRaw raw-view mirror so LGraphNode scalar getters read the
reactive _state proxy directly - node.title/mode/color/etc now track in
Vue effects, matching NodeState (computeExecutionOrder hoists id locally
for its tight loop).
Make node type read-only across all node classes now that _state backs
it: configure special-cases type like id, createNode and the missing-node
placeholder write _state.type, redundant SubgraphNode assignment removed.
Consolidate the duplicated { id, subgraphId } locator shape into
nodeLocatorFromState. Escalate the node-data-store registration-collision
log to console.error. Document the enumerability change and type
immutability for extension authors.
Object.create(SubgraphNode.prototype) skips the constructor, so the node has no _state; assigning id then hit the store-backed accessor on undefined. Seed _state/_stateRaw on the mock and read id through them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Both suites passed object literals to `graph.add`, which crashed in `registerNodeState` once nodes adopted store-held `_state`. Use real `LGraphNode` instances instead of fakes the graph does not own.
`inputs`/`outputs` become accessors over lazily-created `shallowReactive` arrays; assignment replaces contents in place so the identity the renderer subscribed to survives `configure`, `clone`, and the `node.inputs = node.inputs.filter(...)` call sites. `NodeSlot`'s constructor returns `shallowReactive(this)`, so every reference to a slot is the tracked one and a rename reaches the renderer without a reprojection pass. Shallow is deliberate: nested values (`boundingRect`, `_widget`, `pos`) stay raw, keeping `input._widget === widget` and `NodeInputSlot`'s WeakMap index cache correct. A deep `reactive()` would break both. Replaces the runtime `Object.defineProperty` grafting that only ran for nodes present while the Vue renderer was mounted.
All four responsibilities are resolved rather than relocated: - `getNode`/`nodeRefs`: `flags.pinned` reads nodeDataStore; live-node lookups use `canvasStore.currentGraph.getNodeById`. - slot-array graft: reactivity is now class-side from construction. - `node:slot-label:changed` reprojection: slot objects are reactive, so `slot.label = ...` is already a tracked write. - layoutStore seeding: moves to the `LGraph.add`/`LGraph.remove` chokepoints, matching `LGraph.createReroute`. The `configuringGraph` deferral is unnecessary: `add` seeds the entry with whatever geometry the node has, and the `pos`/`size` setters already write through, so `configure` updates it as real values land. The `onNodeAdded` replay loop is gone with it. It re-fired node-added for every pre-existing node on each graph switch, leaking notifications to unrelated subscribers; per-graph bootstrap is solely `layoutStore.initializeFromLiteGraph`. The ancestor guard in useErrorClearingHooks stays — it is reachable by any interior add — but its comment no longer cites the deleted replay. Tests move to the code they exercise: error flags to useNodeErrorFlagSync, widget-store reactivity to widgetValueStore.graphReactivity, layout seeding to LGraph, slot reactivity to NodeSlot.
- `NodeHeader.displayTitle`: ref + watch mirror becomes a computed. The title write path already round-trips through the store accessor, so the optimistic copy had nothing left to optimise. - `showAdvanced`: the customRef seeded its snapshot once at setup, so an external `node.showAdvanced` write never reached the UI. Now a computed over the NodeState proxy. - Drop the `error` prop: it compared the same executionErrorStore field as `hasExecutionError`, which `hasAnyError` already folds in.
- `unregisterAllNodeStates` had no barrel importer. - Five types were exported but only used inside their own file. - A `_stateRaw` mock field and a comment citing a "raw view" that no longer exists. - WidgetItem.test mocked a module that no longer exists, for a symbol it never exported.
Adds migration-plan sections 2c (node shell state), 2d (renderer node lifecycle) and 2e (slot reactivity), and rewrites node-data-store Decisions 3, 6 and 7 — the original plan kept a slimmed successor composable and a `shallowReactive` graft; neither survived. Also corrects the phantom `nodeBadgeStore`: it shipped in #13458 and was deleted in favour of derive-on-read, but three docs still described the file as existing.
The renderer can now ask what slots a node has without resolving the live LGraphNode: `NodeSlots.vue` drops `getNodeByLocatorId` and `app.rootGraph`, and `LGraphNode.vue`'s hasInputs/hasOutputs/hasVideoInput read the store. Slots live in a sibling map beside `graphNodeStates`, the shape widgetValueStore already uses for widget order, rather than a new store. The arrays are held BY REFERENCE — the node's own arrays — so array order is slot order and there is nothing to keep in step. No per-slot key and no slot ids. Index is a property of the containing array, not of the slot, and ~25 sites permute it (including reorderSubgraphInputs, a pure permutation reachable by drag). linkStore shows the cost of keying on an index: six re-keying mechanisms, one a load-time corruption-repair pass added for the reorder case that was originally missed. This rests on `reactive()` returning an already-shallowReactive value unchanged, so the store neither swaps the array's identity nor deep-wraps the slots inside it. Pinned by test; a plain array in the same position WOULD be wrapped, which is why the arrays must stay shallowReactive. Also fixes registerNodeState's ownership marker: `registerNode` now signals refusal with `undefined` instead of returning the caller's own state, so `_graphId` no longer depends on proxy identity differing. Slot cleanup on remove relies on that marker. ExecutableNodeDTO's scale test now bulk-adds with skipComputeOrder, as LGraph.configure does; the per-add updateExecutionOrder is O(n^2) and unrelated to the id generation under test (2.9s -> 0.27s).
MinimapDataSource.test.ts had its own createMockGraph, createMockLinks and graphNode, each ending in `as unknown as`. All three already exist in litegraphTestUtils, so use those and drop the casts. createMockLGraph gains the pieces the minimap needed — node list, groups, links, a getNodeById wired from the nodes, and a self-referencing rootGraph — and both it and createMockLGraphNode build through shoehorn's fromPartial rather than a double cast. Same for createMockLoadedWorkflow, the last `as unknown as` in the file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Required fields first, then optional, alphabetical within each group; the `_state` literal in the LGraphNode ctor and `createNodeState` follow the same order, as does the nodeDataStore return object. Comments cut to what the code cannot say: the NodeState header, the store header, and `nodeHasError` — which keeps only the note that `has_errors` is deliberately not consulted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Third pass, in
Comments — Deferrals, no action — CI is green on One local-only note: |
Also folds the duplicate inline instanceof check in the reordering test into the same helper. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`mountLifecycle` returns null rather than throwing, and the two "expected a link" guards become `expect(...).not.toBeNull()` — an assertion is what they were standing in for. The two widget-state guards go away entirely; `state?.value` reads the same and a missing state still fails the assertion below. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
christian-byrne
left a comment
There was a problem hiding this comment.
- We arguably want to remove some of these modules out of the litegraph folder now
- Can you do a pass that adds asserts? Ideally, we add datadog/Rum as a reporter. On cloud prod, we can check if any invariants throughout the code are failing. Example: trying to LGraph.add node that is structurally identical.
| **Why no keyed `SlotState` and no slot ids.** The draft above proposed | ||
| `getSlotKey(nodeId, index, isInput)`. That is not viable: slot index is a | ||
| property of the containing array, not of the slot, and ~25 sites permute it — | ||
| including `reorderSubgraphInputs` (`subgraphUtils.ts`), a _pure permutation_ with | ||
| no add or remove, reachable by dragging subgraph inputs in the right panel. An | ||
| index-keyed store must re-key on every one of them. `linkStore` shows the price: | ||
| it survives reorder only via six separate mechanisms, one of which | ||
| (`realignInputLinkSlots`, `linkDeduplication.ts`) is a load-time | ||
| corruption-repair pass added for the reorder case that was originally missed | ||
| (#3348). A link's key is derived from fields the link genuinely owns; a slot's | ||
| index is not slot state, so keying on it would be a mirror. |
There was a problem hiding this comment.
Seems reasonable for index to be owned by the container.
There was a problem hiding this comment.
I'd love to not ever need to know the index. If inputs/outputs were always name addressed instead, we wouldn't need to worry about order/insertion/deletion.
| Two consequences worth recording: | ||
|
|
||
| - The **`configuringGraph` deferral is gone.** The `node:added` listener seeds | ||
| the layout entry with whatever geometry the node has; the `pos`/`size` setters | ||
| already write through to `layoutStore`, so `configure()` updates the entry as | ||
| the real values land. No `onAfterGraphConfigured` chaining, no `window.app` | ||
| read. | ||
| - The **`onNodeAdded` replay loop is gone.** It re-fired `onNodeAdded` for every | ||
| pre-existing node on each graph switch, which leaked spurious node-added | ||
| notifications to unrelated subscribers (`useErrorClearingHooks` still carries | ||
| a guard written for exactly that). Per-graph layout bootstrap is now solely | ||
| `layoutStore.initializeFromLiteGraph`, called from `useVueNodeLifecycle` on | ||
| graph entry — which is what makes subgraph navigation seed the right nodes. | ||
|
|
||
| `useVueNodeLifecycle` keeps only layout bootstrap and the Layout↔LiteGraph sync | ||
| lifecycle, and no longer patches anything — see 2g. |
| ### 2g. node:added / node:removed events ✅ Shipped | ||
|
|
||
| `LGraphEventMap` had `node:before-removed` but no add-side counterpart, so every | ||
| consumer that needed to know about a node add wrapped the single | ||
| `graph.onNodeAdded` callback slot, saving and restoring the previous value. | ||
| **Four** did so concurrently: the renderer's empty-graph bootstrap, the | ||
| error-clearing hooks, the minimap, and node-added telemetry. Whichever restored | ||
| first put back the _pre-its-own-install_ value and silently discarded the others | ||
| — order-dependent, per graph switch. | ||
|
|
||
| `LGraph.add` now dispatches `node:added` (after the node is attached and | ||
| registered) and `LGraph.remove` dispatches `node:removed` (after detach, so | ||
| `node.graph` is already null and execution ids must be derived from the | ||
| dispatching graph plus `node.id`). All four consumers are plain | ||
| `addEventListener` subscribers; none touches the callback slot. `onNodeAdded` / | ||
| `onNodeRemoved` remain for extension compatibility. | ||
|
|
||
| `useNodeReplacement` bypasses `graph.add` by design (it swaps a node in place, | ||
| preserving the id), so `replaceWithMapping` announces the add itself. |
There was a problem hiding this comment.
I would prefer if these new events are private. Then we will expose things properly in the public API. Lest people will build on them.
| private setTrackedState<K extends keyof NodeState>( | ||
| property: K, | ||
| value: NodeState[K] | ||
| ): void { | ||
| const oldValue = this._state[property] | ||
| if (oldValue === value) return | ||
|
|
||
| this._state[property] = value | ||
| this.graph?.trigger('node:property:changed', { | ||
| nodeId: this.id, | ||
| property, | ||
| oldValue, | ||
| newValue: value | ||
| }) | ||
| } |
There was a problem hiding this comment.
Seems like it might want to be refactored out of LGraphNode.ts
| node = new base_class(title) | ||
| node._state.type = type | ||
| } catch (error) { | ||
| if (!this.catch_exceptions) throw error |
There was a problem hiding this comment.
is this.catch_exceptions even used?
| function hasMissingMediaOnNode(nodeLocatorId: NodeLocatorId): boolean { | ||
| const executionId = | ||
| useWorkflowStore().nodeLocatorIdToNodeExecutionId(nodeLocatorId) | ||
| return executionId ? missingMediaNodeIds.value.has(executionId) : false | ||
| } | ||
|
|
There was a problem hiding this comment.
Feels like it should be computed
I'll add both of these as TODOs on the stack 🫡 |
|
@christian-byrne thanks for the pass. DrJKL will follow up on the architectural items:
For the two local questions: |
AustinMroz
left a comment
There was a problem hiding this comment.
I missed the train, but the changes have my approval.
| { | ||
| tag: '@vue-nodes' | ||
| }, |
There was a problem hiding this comment.
| { | |
| tag: '@vue-nodes' | |
| }, | |
| { tag: '@vue-nodes' }, |
お疲れ様でした
There was a problem hiding this comment.
I'll assume you're saying I should add newlines to more of these?
| const nodeData = extractVueNodeData(node) | ||
|
|
||
| return { | ||
| ...nodeData, |
| const layoutMutations = useLayoutMutations() | ||
| const { shouldRenderVueNodes } = useVueFeatureFlags() | ||
| const nodeManager = shallowRef<GraphNodeManager | null>(null) | ||
| const isInitialized = shallowRef(false) |
There was a problem hiding this comment.
Shouldn't this just be a ref now?
There was a problem hiding this comment.
shallowRef and ref aren't too terribly different for a boolean value.
| watch(names, onChange) | ||
| expect(names.value).toBe('a,b,c') | ||
|
|
||
| // Extensions mutate this array directly, with no store call to notice. |
Collapses the twelve reviewed slices of the ECS migration into one commit so the series can be replayed onto main as a unit. Each slice kept its own review on GitHub: - ECS: Moving widgets out of the Node data (#13322) - ECS: Link topology store (single source of truth for link data) (#13436) - ECS: Reroute chain store with derived link membership (#13449) - ECS: derive slot floating links; reroute cleanup follow-ups (#13451) - refactor: read widgeted-input connectivity from linkStore (#13455) - feat: nodeBadgeStore + badge system (slice A) (#13458) - refactor: derive badge rows on read, delete the badge store (#13686) - refactor: host-scoped promoted widget rows (no source traversal) (#13434) - refactor!: delete the output.links runtime mirror (#13479) - refactor!: delete the input.link runtime mirror (#13498) - fix: ECS stack audit fixes (#13528) - refactor!: make nodeDataStore the source of truth for node shell state (#13963) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Amp-Thread-ID: https://ampcode.com/threads/T-019ff78d-80f9-73e1-986a-5e4abc9f9d6a
…Shell (#14257) **STACKED — merging lands on `feature/ecs-migration` (owned by @DrJKL, PR #13963's base), NOT `main`.** ## ELI-5 The code that wires a node's "shell state" (title, mode, colours, shape…) into the app's Pinia stores was living inside the vendored `src/lib/litegraph` folder, even though it is entirely app-owned. This moves those definitions into `src/core/graph/nodeShell/` and leaves one-line call sites behind in litegraph. Nothing changes at runtime — same functions, same order, same events. Fulfils the TODO committed to in #13963 (comment). cc @DrJKL ## What moved `src/core/graph/nodeShell/nodeShellState.ts` - `createNodeShellState(title, type, titleMode)` — the object literal that was inline in the `LGraphNode` constructor. - `setTrackedNodeState(node, property, value)` — the body of the former private `LGraphNode.setTrackedState`; the six accessors (`title`, `mode`, `color`, `bgcolor`, `showAdvanced`, `shape`) now call it. - `registerNodeState` / `unregisterNodeState` / `unregisterAllNodeStates` — moved verbatim. `src/core/graph/nodeShell/nodeShellLifecycle.ts` - `attachNodeToStores(graph, node)` — `registerNodeState` plus the widget `setNodeId` / `setNodeWidgetOrder` block that was inline in `LGraph.add`. `LGraph.add` is now a single call, in exactly the position `registerNodeState` occupied (after `node.graph = this`, before `_nodes.push` / `onAdded` / `node:added`). - `releaseGraphStores(graph)` — the store-teardown block from `LGraph.clear`. `LGraph.clear` is now a single call. Also: `LGraph.remove` imports `unregisterNodeState` / `unregisterAllNodeStates` from the new module, `LGraphNode.ts` no longer imports `useNodeDataStore`, and the litegraph barrel no longer re-exports `registerNodeState` / `unregisterNodeState` (new in #13963, nothing external can depend on them yet — keeping the surface private per review feedback). `useNodeReplacement` imports them from the new module instead. `fireNodeRemovalLifecycle` stays in `LGraph.ts` (litegraph events only, no store access), and the link/reroute helpers stay in `LLink.ts` / `Reroute.ts` — `releaseGraphStores` imports them from their current homes. ## Judgment calls - **Two files rather than one.** `nodeShellState.ts` holds the node-level definitions and imports only `nodeDataStore`; `nodeShellLifecycle.ts` holds the graph-level attach/release coordination and is the only one that reaches for `LLink` / `Reroute` / the other stores. That keeps `LGraphNode`'s new runtime import off the `Reroute → litegraph barrel → LGraphNode` cycle. A production `vite build` was run to confirm the module graph still resolves. - **Skipped the optional `graphTriggers.ts` move.** DrJKL's stack (#14110 → #14128 → #14133) is still open against this base, so the diff is kept to a strict definitions-move to keep those rebases cheap. Moving `graphTriggers.ts` would touch the barrel's export path and `LGraph.ts`'s import block for no functional gain in this pass. - **Tests.** The two registration/unregistration cases from `LGraphNode.nodeState.test.ts` moved to `src/core/graph/nodeShell/nodeShellState.test.ts` with assertions unchanged; the accessor and `configure` cases stay where they are. Two new cases cover `createNodeShellState`'s defaults. No test was deleted or weakened. `useNodeReplacement.test.ts`'s barrel mock split into a second `vi.mock` for the new module. ## Verification `pnpm typecheck`, `pnpm lint` (0 errors), `pnpm knip`, and `vite build` are clean. Targeted suites (litegraph, nodeShell, nodeDataStore, nodeReplacement, minimap) — 91 files / 1341 tests pass. Full `vitest run`: 14260 passed, 1 failed — `src/platform/cloud/onboarding/onboardingCloudRoutes.test.ts > lazily resolves the /oauth layout and consent view components`, a 5s timeout on a dynamic route import. It passes in isolation, is untouched by this diff, and an earlier full run under load failed a different pair of tests, so it reads as a load-dependent flake rather than a regression. Flagging rather than hiding it. --------- Co-authored-by: Christian Byrne <cbyrne@comfy.org>
## Summary Still-draft feature branch for migrating entity state from LiteGraph objects and runtime mirrors into dedicated stores with derived, reactive views. This consolidates the reviewed ECS migration slices, strengthens their coverage, incorporates the layout-state follow-up, and documents the current migration status and remaining work. ## Changes - Move widget values and node shell state into dedicated stores. - Make link topology the source of truth for connectivity. - Store reroute chains while deriving membership and floating-link state. - Derive widgeted input connectivity, badges, and promoted widget rows from store-backed state. - Remove the input and output runtime link mirrors. - Keep DOM measurements separate from persisted node layout state. - Add migration coverage, extension guidance, and architecture/status documentation. Reviewed PRs merged into this feature branch: - [Comfy-Org#13322 — Move widgets out of node data](Comfy-Org#13322) - [Comfy-Org#13434 — Host-scoped promoted widget rows](Comfy-Org#13434) - [Comfy-Org#13436 — Link topology store](Comfy-Org#13436) - [Comfy-Org#13449 — Reroute chain store](Comfy-Org#13449) - [Comfy-Org#13451 — Derived floating links and reroute cleanup](Comfy-Org#13451) - [Comfy-Org#13455 — Store-backed widgeted input connectivity](Comfy-Org#13455) - [Comfy-Org#13458 — Badge store and system](Comfy-Org#13458) - [Comfy-Org#13479 — Remove the output-link runtime mirror](Comfy-Org#13479) - [Comfy-Org#13498 — Remove the input-link runtime mirror](Comfy-Org#13498) - [Comfy-Org#13528 — Cross-stack migration audit fixes](Comfy-Org#13528) - [Comfy-Org#13686 — Derive badges on read](Comfy-Org#13686) - [Comfy-Org#13963 — Node data store](Comfy-Org#13963) - [Comfy-Org#14110 — Centralize node, group, and reroute geometry](Comfy-Org#14110) - [Comfy-Org#14128 — Register node geometry at attach](Comfy-Org#14128) - [Comfy-Org#14133 — Read node geometry from the store](Comfy-Org#14133) - [Comfy-Org#14758 — Keep DOM measurements out of saved node sizes](Comfy-Org#14758) - [Comfy-Org#15001 — Extract entity ID allocation](Comfy-Org#15001) - [Comfy-Org#15009 — Scope link and reroute topology by owning graph](Comfy-Org#15009) - [Comfy-Org#15017 — Centralize layout ownership and command submission](Comfy-Org#15017) - [Comfy-Org#15018 — Preserve subgraph topology during unpack](Comfy-Org#15018) - [Comfy-Org#15019 — Transfer node ownership during replacement](Comfy-Org#15019) - [Comfy-Org#15330 — Map migration status and remaining work](Comfy-Org#15330) ## Review Focus - Store ownership and synchronization boundaries. - Serialization, undo/redo, subgraph, and extension compatibility. - Whether remaining direct entity state should migrate before this feature leaves draft. ## Status Still draft. The branch is rebased onto `main`; CI is running against the rebased history. --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Matt Miller <mattmiller@comfy.org>
Summary
Makes
nodeDataStorethe single source of truth for node shell state, deleting theVueNodeDatamirror and all ofuseGraphNodeManager. Continues ADR 0008 after the link topology and reroute chain stores; design record in docs/architecture/node-data-store.md.Stacked on #13528.
Changes
nodeDataStoreholds one plainNodeStateper node in root-graph-scoped buckets keyed byNodeId, registered by reference with proxy-returning registration — theBaseWidgetpattern.LGraphNode's shell fields (title,mode,flags,color,bgcolor,titleMode, …) become accessors over_state, so the class and the store are the same object rather than two copies kept in step. Registration refuses to overwrite a live entry: it logs and returnsundefinedrather than letting a throwaway node hijack a registered id, and the refused caller keeps its own untracked state.VueNodeDataanduseGraphNodeManagerare gone (439 lines plus 683 of tests). All four of the manager's responsibilities were resolved rather than relocated:getNode/nodeRefsbecame store reads plusgetNodeById; the slot-array graft became class-side reactivity from construction; slot-label reprojection became unnecessary once slot objects are reactive; and layoutStore seeding moved to the renderer.Slot arrays and slot objects are
shallowReactivefrom construction, andnodeDataStoreholds the arrays by reference beside the states — the same shapewidgetValueStorealready uses for widget order. Because the arrays are the node's own, array order is slot order and there is nothing to keep in step.node:added/node:removedgraph events replace four concurrent wrappers of the singlegraph.onNodeAddedslot (renderer bootstrap, error-clearing hooks, minimap, telemetry). Whichever restored first put back the pre-its-own-install value and silently discarded the others, order-dependent, on every graph switch. TheonNodeAdded/onNodeRemovedcallbacks still fire, so extension behaviour is unchanged.Two consequences of the above, both found by CI rather than by inspection: layoutStore is seeded from the renderer's event listeners rather than from
LGraph.add, so it stays empty when Vue nodes are off; and the minimap picks its data source by render mode instead of by store emptiness, scoping membership to the viewed graph.The node error ring derives from the error stores rather than the untracked
node.has_errorsfield.useGraphNodeManagerand theVueNodeDatatype are removed. Both were internal; no entity callback,node.widgetsaccess,node.serialize, orgraph._versionbehaviour changes, so the ADR 0008 extension-impact surface is untouched.Review Focus
Register-by-reference, not copy. The store returns the reactive proxy it holds and the node adopts it as
_state. This is what removes the mirror: there is no write-through, no diffing, and no direction to get wrong. The refusal path is the interesting edge — seeregisterNodeand its tests.Why slot arrays are held by reference and not keyed. An index-keyed
SlotStatewas drafted and rejected: slot index is a property of the containing array, not of the slot, and ~25 sites permute it — includingreorderSubgraphInputs, a pure permutation reachable by dragging subgraph inputs in the right panel. An index-keyed store must re-key on every one of them;linkStoreshows the price.A memoisation that was removed for being slower. The
WeakMapcache over input slot index cost more than theindexOfit avoided: Vue routesindexOfto the raw array at ~0.8ns/element, while validating the cache needs a proxied element read plus aWeakMaplookup — 345ns vs 277ns at 3 slots, still slower at 20. Measured, then reverted.Test relocations. Tests moved to the code they now exercise: error flags to
useNodeErrorFlagSync, widget-store reactivity towidgetValueStore.graphReactivity, layout seeding toLGraph, slot reactivity toNodeSlot.