Repository navigation
fix: preserve a live title, flags and colour when serializing missing-node placeholders (BE-8848) - #15719
Conversation
…-node placeholders serialize() replays last_serialization for a missing-node placeholder and previously overrode only mode, pos and size, so a rename, recolour, collapse or pin on a placeholder was discarded on reload. configure() copies the file title/flags/color/bgcolor onto the live node at load, so live-wins on these four fields can only ever carry a deliberate user edit. Unset decorations are deleted rather than conditionally spread, so clearing a colour cannot resurrect the one the file recorded, and the flags key is only emitted when the file had one or the live node has something to say, which keeps an untouched round-trip byte-identical.
|
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:
Comment |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 2013 passed, 0 failed📊 Browser Reports
📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-08-26T19:58:28.913Z",
"gitSha": "2da735531c7831031af3e454e64b7c266a94a8d6",
"branch": "matt/be-8848-placeholder-decorations",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2017.0630000000074,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.099,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 283.65200000000004,
"heapDeltaBytes": 3010000,
"heapUsedBytes": 73782408,
"domNodes": -279,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 5.092,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 1996.467999999993,
"styleRecalcs": 10,
"styleRecalcDurationMs": 5.196999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 281.674,
"heapDeltaBytes": -5006056,
"heapUsedBytes": 66378316,
"domNodes": -280,
"jsHeapTotalBytes": 4186112,
"scriptDurationMs": 4.946000000000001,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1720.6539999999961,
"styleRecalcs": 72,
"styleRecalcDurationMs": 24.205,
"layouts": 12,
"layoutDurationMs": 2.884,
"taskDurationMs": 655.2750000000001,
"heapDeltaBytes": 2056480,
"heapUsedBytes": 73281256,
"domNodes": -278,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 82.405,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1692.8949999999645,
"styleRecalcs": 71,
"styleRecalcDurationMs": 24.628,
"layouts": 12,
"layoutDurationMs": 2.924,
"taskDurationMs": 673.173,
"heapDeltaBytes": -12264876,
"heapUsedBytes": 59734908,
"domNodes": -280,
"jsHeapTotalBytes": 7593984,
"scriptDurationMs": 86.285,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1658.348999999987,
"styleRecalcs": 31,
"styleRecalcDurationMs": 10.308,
"layouts": 6,
"layoutDurationMs": 0.516,
"taskDurationMs": 196.613,
"heapDeltaBytes": 4621120,
"heapUsedBytes": 76395916,
"domNodes": 78,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 6.204,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1710.1519999999937,
"styleRecalcs": 30,
"styleRecalcDurationMs": 10.776000000000002,
"layouts": 6,
"layoutDurationMs": 0.542,
"taskDurationMs": 197.371,
"heapDeltaBytes": 4413320,
"heapUsedBytes": 76358104,
"domNodes": 77,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 6.531000000000001,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 534.953999999999,
"styleRecalcs": 15,
"styleRecalcDurationMs": 5.944,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 386.654,
"heapDeltaBytes": 6185636,
"heapUsedBytes": 78126376,
"domNodes": 20,
"jsHeapTotalBytes": 6291456,
"scriptDurationMs": 81.92399999999999,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "dom-widget-clipping",
"durationMs": 543.7009999999987,
"styleRecalcs": 14,
"styleRecalcDurationMs": 5.894,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 393.80899999999997,
"heapDeltaBytes": 6829888,
"heapUsedBytes": 78740244,
"domNodes": 20,
"jsHeapTotalBytes": 6291456,
"scriptDurationMs": 84.69,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "large-graph-idle",
"durationMs": 2017.2939999999926,
"styleRecalcs": 8,
"styleRecalcDurationMs": 4.434,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 296.667,
"heapDeltaBytes": -1178712,
"heapUsedBytes": 77129052,
"domNodes": -264,
"jsHeapTotalBytes": -1880064,
"scriptDurationMs": 17.479000000000003,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2009.2819999999847,
"styleRecalcs": 6,
"styleRecalcDurationMs": 3.0509999999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 293.00000000000006,
"heapDeltaBytes": -1320532,
"heapUsedBytes": 77248436,
"domNodes": -268,
"jsHeapTotalBytes": -2404352,
"scriptDurationMs": 18.370000000000005,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2302.2119999999973,
"styleRecalcs": 70,
"styleRecalcDurationMs": 12.711,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1435.9599999999998,
"heapDeltaBytes": 7623584,
"heapUsedBytes": 87182252,
"domNodes": -266,
"jsHeapTotalBytes": 3325952,
"scriptDurationMs": 511.6959999999999,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-pan",
"durationMs": 2263.9669999999796,
"styleRecalcs": 67,
"styleRecalcDurationMs": 10.699999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1381.307,
"heapDeltaBytes": 21197624,
"heapUsedBytes": 86117856,
"domNodes": -270,
"jsHeapTotalBytes": 3371008,
"scriptDurationMs": 489.36899999999997,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3561.036999999999,
"styleRecalcs": 67,
"styleRecalcDurationMs": 10.899,
"layouts": 60,
"layoutDurationMs": 7.482,
"taskDurationMs": 1386.4429999999998,
"heapDeltaBytes": -3752592,
"heapUsedBytes": 66585132,
"domNodes": 26,
"jsHeapTotalBytes": 2359296,
"scriptDurationMs": 482.21500000000003,
"eventListeners": 10,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3564.4100000000094,
"styleRecalcs": 68,
"styleRecalcDurationMs": 11.056,
"layouts": 60,
"layoutDurationMs": 7.318,
"taskDurationMs": 1396.171,
"heapDeltaBytes": -2956080,
"heapUsedBytes": 67234860,
"domNodes": 28,
"jsHeapTotalBytes": 2883584,
"scriptDurationMs": 479.58299999999997,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "legacy-node-drag",
"durationMs": 3089.6789999999896,
"styleRecalcs": 43,
"styleRecalcDurationMs": 5.937000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1926.818,
"heapDeltaBytes": 16529156,
"heapUsedBytes": 88048348,
"domNodes": 6,
"jsHeapTotalBytes": 1990656,
"scriptDurationMs": 502.9049999999999,
"eventListeners": 186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "legacy-node-drag",
"durationMs": 3130.957999999964,
"styleRecalcs": 43,
"styleRecalcDurationMs": 6.0950000000000015,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1959.455,
"heapDeltaBytes": 15739328,
"heapUsedBytes": 83066044,
"domNodes": 6,
"jsHeapTotalBytes": 5660672,
"scriptDurationMs": 503.11800000000005,
"eventListeners": 188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2005.6490000000053,
"styleRecalcs": 6,
"styleRecalcDurationMs": 3.013,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 284.47299999999996,
"heapDeltaBytes": -2249436,
"heapUsedBytes": 78097212,
"domNodes": -269,
"jsHeapTotalBytes": -2666496,
"scriptDurationMs": 18.808,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2009.253000000001,
"styleRecalcs": 6,
"styleRecalcDurationMs": 3.1959999999999993,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 288.369,
"heapDeltaBytes": -2108812,
"heapUsedBytes": 77427728,
"domNodes": -268,
"jsHeapTotalBytes": -1880064,
"scriptDurationMs": 17.612000000000002,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 448.76699999997527,
"styleRecalcs": 47,
"styleRecalcDurationMs": 8.134,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 299.66299999999995,
"heapDeltaBytes": -8010084,
"heapUsedBytes": 64752008,
"domNodes": 20,
"jsHeapTotalBytes": 7602176,
"scriptDurationMs": 81.579,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 465.43499999995674,
"styleRecalcs": 47,
"styleRecalcDurationMs": 8.253,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 305.024,
"heapDeltaBytes": -7946796,
"heapUsedBytes": 64461212,
"domNodes": 20,
"jsHeapTotalBytes": 6029312,
"scriptDurationMs": 84.49900000000001,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.663333333333338,
"p95FrameDurationMs": 16.799999999999727
},
{
"name": "subgraph-idle",
"durationMs": 1993.0500000000109,
"styleRecalcs": 10,
"styleRecalcDurationMs": 4.9350000000000005,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 270.46400000000006,
"heapDeltaBytes": -14320040,
"heapUsedBytes": 58536236,
"domNodes": -296,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 4.248,
"eventListeners": -199,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 1992.5810000000297,
"styleRecalcs": 10,
"styleRecalcDurationMs": 4.885000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 266.34499999999997,
"heapDeltaBytes": -13871904,
"heapUsedBytes": 58282928,
"domNodes": -296,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 4.038000000000002,
"eventListeners": -199,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1677.4350000000027,
"styleRecalcs": 76,
"styleRecalcDurationMs": 23.779999999999994,
"layouts": 16,
"layoutDurationMs": 3.5120000000000005,
"taskDurationMs": 627.8589999999999,
"heapDeltaBytes": -3879292,
"heapUsedBytes": 68944604,
"domNodes": -296,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 67.76199999999999,
"eventListeners": -199,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1677.3829999999634,
"styleRecalcs": 74,
"styleRecalcDurationMs": 24.52,
"layouts": 16,
"layoutDurationMs": 3.672,
"taskDurationMs": 631.6460000000001,
"heapDeltaBytes": -3249592,
"heapUsedBytes": 69053548,
"domNodes": -298,
"jsHeapTotalBytes": 6283264,
"scriptDurationMs": 69.53099999999999,
"eventListeners": -199,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 750.2349999999751,
"styleRecalcs": 21,
"styleRecalcDurationMs": 19.799000000000003,
"layouts": 16,
"layoutDurationMs": 8.52,
"taskDurationMs": 512.675,
"heapDeltaBytes": 23445152,
"heapUsedBytes": 106078512,
"domNodes": 13671,
"jsHeapTotalBytes": 10485760,
"scriptDurationMs": 15.765,
"eventListeners": 2381,
"totalBlockingTimeMs": 53,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8404.830000000004,
"styleRecalcs": 250,
"styleRecalcDurationMs": 38.282999999999994,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4976.057,
"heapDeltaBytes": 9161244,
"heapUsedBytes": 87444044,
"domNodes": -264,
"jsHeapTotalBytes": 1228800,
"scriptDurationMs": 1717.3229999999999,
"eventListeners": -135,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8410.942999999974,
"styleRecalcs": 250,
"styleRecalcDurationMs": 37.94799999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4969.268999999999,
"heapDeltaBytes": 3001460,
"heapUsedBytes": 81575908,
"domNodes": -242,
"jsHeapTotalBytes": 3325952,
"scriptDurationMs": 1729.485,
"eventListeners": -167,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "vue-large-graph-idle",
"durationMs": 10330.134999999984,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 9371.159,
"heapDeltaBytes": -19188572,
"heapUsedBytes": 175258744,
"domNodes": -6548,
"jsHeapTotalBytes": -4362240,
"scriptDurationMs": 156.403,
"eventListeners": -7475,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333338,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 10276.738000000023,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 9365.47,
"heapDeltaBytes": -33257692,
"heapUsedBytes": 181491024,
"domNodes": -6548,
"jsHeapTotalBytes": -1105920,
"scriptDurationMs": 140.88899999999998,
"eventListeners": -7475,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-pan",
"durationMs": 13623.20699999998,
"styleRecalcs": 68,
"styleRecalcDurationMs": 11.371999999999993,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 13008.524000000001,
"heapDeltaBytes": -21265268,
"heapUsedBytes": 187372208,
"domNodes": -6548,
"jsHeapTotalBytes": 716800,
"scriptDurationMs": 550.488,
"eventListeners": -7473,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 13167.805000000044,
"styleRecalcs": 66,
"styleRecalcDurationMs": 11.273999999999978,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12770.321,
"heapDeltaBytes": -20936128,
"heapUsedBytes": 191510684,
"domNodes": -6548,
"jsHeapTotalBytes": 1929216,
"scriptDurationMs": 528.164,
"eventListeners": -7475,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.219999999999953,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "workflow-execution",
"durationMs": 439.5560000000387,
"styleRecalcs": 24,
"styleRecalcDurationMs": 19.348,
"layouts": 3,
"layoutDurationMs": 1.0230000000000001,
"taskDurationMs": 96.12,
"heapDeltaBytes": 6064012,
"heapUsedBytes": 74037856,
"domNodes": 154,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 6.151999999999999,
"eventListeners": 99,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "workflow-execution",
"durationMs": 72.61200000004919,
"styleRecalcs": 8,
"styleRecalcDurationMs": 10.742,
"layouts": 2,
"layoutDurationMs": 0.48400000000000004,
"taskDurationMs": 50.644000000000005,
"heapDeltaBytes": 3658180,
"heapUsedBytes": 71748484,
"domNodes": 106,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 3.0729999999999995,
"eventListeners": 49,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
}
]
} |
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @mattmillerai.
Found 4 finding(s).
| Severity | Count |
|---|---|
| 🟡 Medium | 2 |
| 🟢 Low | 2 |
Panel: 8/8 reviewers contributed findings.
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## matt/fe-1817-serialize-placeholder-size #15719 +/- ##
===========================================================================
- Coverage 79.49% 79.49% -0.01%
===========================================================================
Files 1947 1947
Lines 118500 118509 +9
Branches 33531 34004 +473
===========================================================================
+ Hits 94196 94203 +7
Misses 23803 23803
- Partials 501 503 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Review follow-up on the placeholder decoration mirror.
shape and boxcolor are serialized by the normal path and are user-mutable on
a placeholder (useNodeCustomization.applyShape and LGraphCanvas
.onMenuNodeShapes act on any selected LGraphNode), so leaving them to replay
from the file dropped those edits on save - the same data loss this branch
sets out to fix. They now join title, color and bgcolor in the live mirror.
The five mirrored keys are omitted from the replayed serialization before the
live values are spread back over it, which replaces the per-key delete chain
and keeps "cleared decorations do not resurrect the recorded value" true for
every key by construction rather than one branch at a time.
flags is required by zComfyNode and zFlags is a non-nullable object, so the
previous absence round-trip emitted a node the workflow schema rejects, which
surfaces as a validation alert and skips tryFixLinks repair on the next open.
An empty object faithfully represents "no flags" and is schema-valid, so the
key is now always emitted; the v0.4 fixture snapshot gains "flags": {}
accordingly. Guarding this.flags with optional chaining also keeps the branch
consistent with the defensive reads elsewhere in the class.
|
🤖 The reviews loop filed Linear follow-up ticket(s) for review thread(s) deferred as out of scope for this PR:
The following carry
|
…er-size' into matt/be-8848-placeholder-decorations # Conflicts: # src/lib/litegraph/src/LGraphNode.ts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…t node (#15734) **STACKED — merging lands on `matt/be-8848-placeholder-decorations` (owned by mattmillerai, #15719), NOT `main`.** #15719 is itself stacked on #15713. Review and land those first; this PR is behaviour-neutral without #15719 (it is the change that makes `serialize()` return live values on a placeholder). ## ELI-5 When a workflow references a node pack you don't have installed, ComfyUI draws a placeholder in its place. You can rename that placeholder and give it a colour, same as any node. Later you install the pack, hit "replace", and the real node appears — but it came back with the title from the file and no colour at all, quietly throwing away the rename and the colour you'd applied. This makes the replacement inherit what's actually on screen. ## Summary The node-replacement flow read a placeholder's load-time snapshot instead of the live node, and dropped its colours entirely; both are now taken from `serialize()` and applied to the replacement. ## Changes - **What**: `replaceWithMapping` and the default-mapping call in `src/platform/nodeReplacement/useNodeReplacement.ts` now read `node.serialize()` rather than `node.last_serialization ?? node.serialize()`. The `?? node.serialize()` arm was dead code — the placeholder collection filter requires `n.last_serialization` to exist — so every replacement replayed the file's title, and a rename made after load was silently lost. Separately, `replaceWithMapping` applied only `title` from the serialized data; `color`, `bgcolor`, `boxcolor` and `shape` were serialized but never copied, so a recoloured placeholder became a default-coloured replacement node. Those four are now applied alongside `title`. - **Breaking**: none. Structural fields (`type` / `inputs` / `outputs` / `properties` / `widgets_values`) are unaffected: only bare `LGraphNode` instances carry `last_serialization` (verified — all three placeholder-creation sites use `new LGraphNode(...)`), and that branch of `serialize()` replays those fields verbatim from `last_serialization`, overlaying only `mode` / `pos` / `flags` / decorations (and live `size` when expanded). The mapping and widget-transfer logic therefore sees identical input. ## Review Focus - **The riskiest line is dropping the `last_serialization` short-circuit.** Its safety rests on the claim above: everything reaching `replaceWithMapping` is a bare `LGraphNode` with `last_serialization` set, so `serialize()` takes the placeholder branch. If a subclassed node could ever carry `last_serialization`, `serialize()` would derive `inputs`/`outputs` from the live (registered) definition instead of replaying the file's, and the mapping would be built against the wrong shape. The three creation sites are `LGraph.configure`, `LGraph`'s subgraph-unpack path, and the API-format loader in `src/scripts/app.ts` — all `new LGraphNode(...)`. - **Propagating colours is only correct because nothing assigns them programmatically as error styling.** Swept for this: `boxcolor` is never assigned anywhere outside serialization, and `bgcolor` is assigned only by the Note node and by the explicit user colour pickers. Missing-node styling rides on the `has_errors` flag, which `replaceWithMapping` already clears. So a colour present on a placeholder is a colour the user put there. - **Scope sweep.** 14 non-test references to `last_serialization` exist under `src/`. This PR changes 2 (both in the node-replacement flow). The other 12 are left alone deliberately: 4 are reads that only want `.type` or the existence check used as the placeholder discriminator (`missingNodeScan.ts`, `useErrorClearingHooks.ts`, and the two in the collection filter here), and 8 are the write/definition side (`LGraph.ts`, `src/scripts/app.ts`, `LGraphNode.ts`). - **Test-helper change.** `createPlaceholderNode`'s `serialize` stub previously returned a frozen object literal that ignored the `last_serialization` the tests mutate after construction. Once the call site stops reading `last_serialization`, that stub is wrong — every widget-transfer test would have failed for the wrong reason. It now derives from `node.last_serialization` plus the node's live fields, mirroring the real placeholder branch. No existing test's assertions changed. - **Coordination**: open PR #14286 rewrites `transferWidgetValue` in this same file. No functional overlap with these lines; needs a trivial rebase if it lands first. ## Provenance - **Authored by:** agent-work loop - **Verified:** `pnpm vitest run src/platform/nodeReplacement src/lib/litegraph/test`: 122 passed, 0 failed. `pnpm test:unit`: 16552 passed, 13 failed — 12 of them in `scripts/cicd/check-binary-size.test.ts`, reproduced identically with this change stashed (pre-existing, environment-dependent), plus one 5s-timeout flake in a `firstRunTour` test that passed on re-run. Red-check on the new test: reverting the `serialize()` read alone fails it on the title, and dropping the four decoration lines alone fails it on the colour — so it discriminates both halves. `pnpm typecheck`, `pnpm lint`, `pnpm format`, `pnpm knip`: clean. - **Deviations:** The new test builds its placeholder with this suite's existing `fromAny` mock helper rather than a real `LGraphNode` instance; the file mocks the whole litegraph module, so a real instance is not constructible there. Verification is the unit suite plus a source sweep — there is no in-app repro in this run for the full missing-node → install-pack → replace journey, so the user-visible outcome is asserted at the composable boundary rather than on screen. The originating tracker issue and its investigation notes are internal and were not readable from this environment; the change was implemented from the specification handed to this run and cross-checked against the code itself.
**STACKED — merging lands on `matt/be-8848-placeholder-decorations` (owned by @mattmillerai, PR #15719), NOT `main`.** That branch is itself stacked on #15713. Do not merge this until both land; it is not "ready to merge" on its own. ## ELI-5 If a node in your workflow comes from an extension you do not have installed, the frontend draws a placeholder in its place. Because it has no node definition to work from, saving the workflow replays whatever the file said about that node instead of regenerating it. #15713 made an *expanded* placeholder save its live size, but a *collapsed* one falls back to the size recorded in the file — and that record was written once when the workflow loaded and never updated. So: resize a placeholder, collapse it, save — and the resize was thrown away. This makes collapsing and expanding both refresh that record, so the size you last gave the placeholder is the one that gets saved. ## Summary `collapse()` now keeps a missing-node placeholder's recorded serialization size and its live size in sync in **both** directions, so a resize made while expanded survives a collapse-then-save round trip and is not lost again on the way back out. ## Changes - **Collapsing** copies the live size into `last_serialization.size`. #15713's rule is kept intact — a collapsed placeholder still serializes the *recorded* size, since it has no definition to re-derive an expanded one from; what changes is that "recorded" now means the last known expanded size rather than the load-time one. - **Expanding** restores the live size *from* `last_serialization.size`. In Vue nodes mode `node.size` is a DOM measurement of whichever card is rendered (`useLayoutSync.ts:55` writes the ResizeObserver's bounds into `liteNode.size`), so immediately after an expand it still holds the collapsed card's dimensions until the next measurement lands a frame later. Without the restore, a `serialize()` inside that window persisted the collapsed dimensions, and a second collapse inside it re-recorded them — destroying the value the refresh exists to preserve. - Both halves run **before** the `flags.collapsed` flip, so each reads `node.size` while it still measures the card the node is leaving. - Two guards remain: `this.constructor === LGraphNode` (mirrors `serialize()`'s own placeholder test) and `last_serialization?.size != null` (preserves #15713's "does not invent a size when the recorded serialization has none" rule). The `!this.flags.collapsed` guard is gone — the flag now selects the direction instead of gating the write. - The record is **replaced** rather than mutated in place, because `LGraph.configure()` assigns `last_serialization` by reference straight out of the caller's `data.nodes` (`LGraph.ts:2626`; the dedup clone at `LGraph.ts:2599` only kicks in for workflows with subgraph definitions). Writing through it would corrupt a retained caller snapshot, and would throw if the input were frozen — aborting the collapse before the flag flipped. - Six tests in the `missing-node placeholder serialization` block in `LGraphNode.test.ts`. ## Review Focus - **The direction switch in `collapse()`.** It is the whole change. Canvas mode never overwrites `node.size` on collapse, so there the restore rewrites the values it just recorded and is a no-op; the asymmetry only exists under Vue nodes. - **Restoring through the `size` setter** (`this.size = recordedSerialization.size`) rather than `setSize()`: the setter copies element-wise (no aliasing with `last_serialization`), guards `length < 2`, and mirrors into the layout store, but does not fire `onResize`. Since the restore happens while the node is still flagged collapsed, `LGraphNode.vue`'s `handleLayoutChange` bails out and the DOM is restored by the existing `isCollapsed` watch's `--node-width-x` stash instead. - **Reassigning `last_serialization`.** No reader caches the object identity — `useNodeReplacement.ts:178`, `missingNodeScan.ts:28`, `useErrorClearingHooks.ts:236` and the rest read fields at call time — and the load-time writes that *do* rely on the aliasing (`app.ts:2222`, `app.ts:2270`, `LGraph.ts:2007`) all run long before any collapse. - **Second consumer of the refreshed field.** `useNodeReplacement.ts` uses `node.last_serialization ?? node.serialize()` when swapping a placeholder for a real node, so a replacement now inherits the last expanded size rather than the load-time one. That is the intended direction, but it is worth a look. - **Incidental fix.** Expanding a placeholder that was *loaded* collapsed and then saving used to persist the collapsed card measurement. The restore fixes that too; it predates this PR. ## Sweep The hook is in `collapse()` only, on the premise that nothing else flips the flag. Sweeping `flags.collapsed =` across `src/`, `browser_tests/` and `apps/`: **1** non-test source assignment — the line this change sits in front of — and **17** assignments across 7 test files, none of which are product paths and none of which are touched here. All **5** non-test `.collapse(` call sites (`useNodeEventHandlers.ts`, `useCoreCommands.ts`, `useSelectedNodeActions.ts`, and two in `LGraphCanvas.ts`) route through the hook. So the portion deliberately not covered is the direct-flag path, which exists only in tests. ## Notes and judgment calls - The plan this came from expected #15713's `keeps the recorded size while collapsed` test to still set `flags.collapsed` directly, and said to leave it untouched. #15719 had already rewritten it to call `collapse(true)`. I left it untouched either way and it still passes — at collapse time the placeholder's live size *is* the recorded `[140, 60]`, so the refresh is a no-op there — but it no longer documents the direct-flag edge the plan described. I did not add a replacement test for that edge, since no product code reaches it (see Sweep). - The first revision of this PR shipped the collapse half only, and justified writing to `last_serialization` in place by citing `app.ts` as precedent. That citation was wrong: the objects `app.ts:2222` and `app.ts:2270` mutate are constructed at `app.ts:2195`, so that code owns them. Nothing established the pattern for a borrowed object, hence the replace. - Based on `matt/be-8848-placeholder-decorations` rather than `main` because the added tests assert `flags.collapsed` in the output (#15719) and reuse the `createPlaceholder` helper (#15713). The production change itself also composes with today's `main`, where `serialize()` unconditionally replays `last_serialization.size`. - No capability is denied or removed by this diff, so the negative-claim falsification check does not apply. ## Unexercised - Verification is unit-level. I did not run the Playwright suite or drive Vue nodes mode in a browser. The Vue-mode measurement timing that motivates both the before-the-flip capture and the restore is read off `useLayoutSync.ts` and `LGraphNode.vue` rather than observed live, so the *width* of the re-measure window is inferred, not bounded empirically. The fix does not depend on that width — it closes the window synchronously rather than racing it. - The read-only investigation this implementation came from lives in an internal tracker this environment cannot reach, so its findings were taken as given from the plan text rather than re-derived. ## Provenance - **Authored by:** agent-work loop - **Verified:** `pnpm test:unit src/lib/litegraph src/platform/nodeReplacement src/renderer/core/layout src/renderer/extensions/vueNodes` — 178 files, 2330 passed / 3 expected-fail / 12 skipped, 0 failed; `pnpm test:unit src/lib/litegraph/src/LGraphNode.test.ts` — 51 passed; call-site suites (`useCoreCommands`, `useLoad3d`) — 134 passed; `pnpm typecheck` — clean; `oxlint`, `oxfmt --check` and lint on both changed files — clean. Red/green checked on all three new tests: deleting the restore-on-expand line fails 2 of them with `expected [ 80, 30 ] to deeply equal [ 777, 666 ]`, and reverting the replace to an in-place mutation fails the third. - **Deviations:** none of the plan's acceptance criteria were skipped. Two departures from the plan as written, both explained under "Notes and judgment calls": the existing-test premise no longer matches, and the plan scoped only the collapse direction — review found the expand direction was load-bearing for the same guarantee, so it is included here rather than deferred.
c5216d5
into
matt/fe-1817-serialize-placeholder-size
STACKED — merging lands on
matt/fe-1817-serialize-placeholder-size(owned by @mattmillerai, PR #15713), NOTmain. Review/merge #15713 first; this PR's diff is only the commit on top.ELI-5
If ComfyUI can't find a node's code, it draws a grey stand-in and remembers the node's original text so nothing is lost when you install the missing pack later. You could rename that stand-in, colour it, reshape it, collapse it or pin it — and every one of those edits vanished the next time you opened the workflow, because saving replayed the remembered text verbatim. Now your edits stick, and a stand-in you never touched still saves what it loaded.
Summary
serialize()'s missing-node placeholder branch replayslast_serializationand overrides onlymode/pos(and, on the branch this stacks on,size). This extends that override to every user-decoration field —title,flags,color,bgcolor,boxcolor,shape— so a rename, recolour, reshape, collapse or pin on a placeholder survives save + reload.Changes
LGraphNode.serialize(), the live node now wins fortitle,flags,color,bgcolor,boxcolorandshape.configure()copies those from the file onto the live node at load, so they can only diverge from the file when the user deliberately edited them — live-wins can never lose information the file had.omitted from the replayed serialization and the live values spread back over it, so "a cleared decoration cannot resurrect the file's recorded value" holds for every key by construction instead of onedeletebranch at a time.titlereuses the normal path'sthis.title !== this.constructor.titleguard so a file with no title does not gain one on round-trip.flagsis always emitted.zComfyNode.flagsis required andzFlagsis a non-nullable object, so round-tripping the absence offlagsproduced a node the workflow schema rejects — a validation alert, andtryFixLinksrepair skipped on the next open.{}faithfully represents "no flags" and is schema-valid.o.flagsiscloneObject(this.flags), sopinnedandcollapsedride along and the replayed object no longer aliaseslast_serialization.flags.type,inputs,outputs,properties,widgets_values,widgets_values_namedstill replay from the file — no node definition exists to regenerate them. Thewidgets_valuesindex asymmetry is separately tracked (Widget values shift by one slot on reload when an earlier widget has serialize === false #15669 / PR fix: restore widgets_values by full widget index (#15669) #15688) and is not bundled here.flagskey now round-trips as"flags": {}— deliberate, and the reasonLGraph.test.ts.snap's v0.4 fixture gains that key.Review Focus
Chesterton's-fence check on
flags. This flips a field that previously always replayed from the file, so I read the history first.bdf6d4dea2("Allow updating position and mode on missing nodes", #6792, AustinMroz) introduced the replay to keep the "last known good" serialization so the node still works once the missing pack is installed, and addedpos/modeas the "small and safe changes" that should not be discarded. The decoration fields are the same class — pure decoration that cannot affect whether the node resolves when the pack is reinstalled — so extending the same override is consistent with that intent rather than against it.The
flags-absence round-trip was dropped after review. An earlier revision emittedflagsonly when the file had one or the live node had a flag to record, to keep the v0.4 fixture snapshot byte-identical. That is the wrong trade:flagsis schema-required, so preserving the absence preserves an invalid node. The snapshot now records"flags": {}and the placeholder emits a document the schema accepts.shapeandboxcolorwere folded in after review. They were initially scoped out as a separate call about decoration-vs-geometry. They are serialized by the normal path and user-mutable on a placeholder —useNodeCustomization.applyShape(src/composables/graph/useNodeCustomization.ts:113) andLGraphCanvas.onMenuNodeShapesboth act on any selectedLGraphNodewith nohas_errorsgate — so leaving them out kept the exact data-loss class this PR closes. They are decoration by the same Chesterton's-fence argument as the rest.Known adjacent gap, not fixed here (follow-up proposed).
last_serializationis a load-time snapshot that is never refreshed, and two consumers read it directly rather than throughserialize():useNodeReplacement.replaceWithMapping(src/platform/nodeReplacement/useNodeReplacement.ts:177) appliesserialized.titlefrom it, so a renamed placeholder reverts to the file's title once the missing pack is installed; and resizing an expanded placeholder then collapsing it serializes the stale recorded size. Both need a refresh policy that interacts with #15713's deliberate collapsed-size rule, so they are tracked separately rather than bundled.Provenance
pnpm vitest run src/lib/litegraph src/platform src/scripts src/composables— 537 files, 8259 passed, 7 expected-fail, 5 skipped, 0 failed;pnpm typecheck— clean;pnpm lint— 0 errors (3 pre-existing warnings in unrelated files);pnpm format— no changes outside the two edited files.LGraph.test.ts.snapintentionally updated (v0.4 fixture gains"flags": {}); no other snapshot moved.flags-absence guard (it preserved a schema-invalid document) and the exclusion ofshape/boxcolor(they are user-mutable on placeholders, so excluding them left the bug open). No test asserts clearingshape, becauseLGraphNodePropertiesinstrumentsshapeas an own data property that shadows the prototype accessor, sonode.shape = 'default'stores the raw string instead ofundefined; that is a pre-existing repo-wide quirk of the legacy string API, and the Vue path (useNodeCustomization) only ever assignsRenderShapeenum values, which are all truthy. No screenshots — this is a serialization change with no visual surface.