Repository navigation
fix(vue-nodes): reflow node when custom nodes grow size at runtime (size Proxy) - #13867
Conversation
Extensions like rgthree Power Lora Loader add rows after mount via node.addCustomWidget() then set node.size[1] directly. The direct element mutation bypasses the `set size` setter, the only path that mirrors height into layoutStore, so Vue nodes kept a stale height until a manual resize. Watch the widget count and re-commit node.size on change to close the seam. The commit no-ops when size is unchanged, so it cannot start a size-sync feedback loop. Fixes #13863 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds a devtools node for client-side runtime growth, synchronizes direct LiteGraph size mutations with the Vue layout store, and adds unit and Playwright coverage for widget and image-preview reflow. ChangesRuntime node reflow
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant BrowserTest
participant RuntimeReflowNode
participant LGraphNode
participant layoutStore
participant VueNode
BrowserTest->>RuntimeReflowNode: invoke growth callback
RuntimeReflowNode->>LGraphNode: mutate node size
LGraphNode->>layoutStore: commit resizeNode
layoutStore->>VueNode: update rendered layout
VueNode-->>BrowserTest: expose increased bounding-box height
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🎭 Playwright: ✅ 1719 passed, 0 failed · 3 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook📦 Bundle: 8.03 MB gzip 🔴 +1.33 kBDetailsSummary
Category Glance App Entry Points — 47.5 kB (baseline 47.5 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.25 MB (baseline 1.25 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed / 1 unchanged Views & Navigation — 110 kB (baseline 110 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 11 added / 11 removed / 4 unchanged Panels & Settings — 551 kB (baseline 551 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 11 added / 11 removed / 15 unchanged User & Accounts — 29.1 kB (baseline 29.1 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 7 added / 7 removed / 3 unchanged Editors & Dialogs — 121 kB (baseline 121 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 5 added / 5 removed / 1 unchanged UI Components — 64.7 kB (baseline 64.7 kB) • ⚪ 0 BReusable component library chunks
Status: 6 added / 6 removed / 8 unchanged Data & Services — 271 kB (baseline 271 kB) • ⚪ 0 BStores, services, APIs, and repositories
Status: 13 added / 13 removed / 3 unchanged Utilities & Hooks — 3.45 MB (baseline 3.45 MB) • 🔴 +2.51 kBHelpers, composables, and utility bundles
Status: 16 added / 16 removed / 20 unchanged Vendor & Third-Party — 15.7 MB (baseline 15.7 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 16 unchanged Other — 12.1 MB (baseline 12.1 MB) • ⚪ 0 BBundles that do not match a named category
Status: 66 added / 66 removed / 207 unchanged ⚡ Performance Report
✅ No regressions detected. All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-07-23T00:38:51.806Z",
"gitSha": "1b085a4d2c19553da478cb8a71c86cb53d99a113",
"branch": "fix/bug021-widget-growth-reflow",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2021.7079999999896,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.6160000000000005,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 304.419,
"heapDeltaBytes": 3806736,
"heapUsedBytes": 73584284,
"domNodes": 22,
"jsHeapTotalBytes": 19279872,
"scriptDurationMs": 12.804,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-idle",
"durationMs": 2027.215999999953,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.069999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 321.64000000000004,
"heapDeltaBytes": 3933964,
"heapUsedBytes": 73487336,
"domNodes": 22,
"jsHeapTotalBytes": 19542016,
"scriptDurationMs": 13.342000000000002,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1774.0519999999833,
"styleRecalcs": 72,
"styleRecalcDurationMs": 22.465,
"layouts": 12,
"layoutDurationMs": 2.102,
"taskDurationMs": 640.903,
"heapDeltaBytes": -17146612,
"heapUsedBytes": 52576476,
"domNodes": -263,
"jsHeapTotalBytes": 18620416,
"scriptDurationMs": 81.66399999999999,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1720.425999999975,
"styleRecalcs": 74,
"styleRecalcDurationMs": 22.796,
"layouts": 12,
"layoutDurationMs": 2.2239999999999998,
"taskDurationMs": 571.246,
"heapDeltaBytes": -19324036,
"heapUsedBytes": 50388528,
"domNodes": -263,
"jsHeapTotalBytes": 20455424,
"scriptDurationMs": 74.371,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1711.6639999999848,
"styleRecalcs": 31,
"styleRecalcDurationMs": 12.047000000000002,
"layouts": 6,
"layoutDurationMs": 0.481,
"taskDurationMs": 253.95799999999997,
"heapDeltaBytes": 7486608,
"heapUsedBytes": 77094464,
"domNodes": 77,
"jsHeapTotalBytes": 19279872,
"scriptDurationMs": 14.515,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1671.0170000000062,
"styleRecalcs": 32,
"styleRecalcDurationMs": 11.747,
"layouts": 6,
"layoutDurationMs": 0.4409999999999999,
"taskDurationMs": 240.88000000000002,
"heapDeltaBytes": 7490348,
"heapUsedBytes": 77171992,
"domNodes": 79,
"jsHeapTotalBytes": 19017728,
"scriptDurationMs": 13.808,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "dom-widget-clipping",
"durationMs": 395.8099999999831,
"styleRecalcs": 11,
"styleRecalcDurationMs": 4.593,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 236.72699999999998,
"heapDeltaBytes": -12174992,
"heapUsedBytes": 57332176,
"domNodes": 18,
"jsHeapTotalBytes": 19804160,
"scriptDurationMs": 35.881,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 406.8839999999909,
"styleRecalcs": 13,
"styleRecalcDurationMs": 5.518000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 244.78900000000004,
"heapDeltaBytes": -12196620,
"heapUsedBytes": 57390444,
"domNodes": 22,
"jsHeapTotalBytes": 20066304,
"scriptDurationMs": 37.157,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "large-graph-idle",
"durationMs": 2010.0180000000023,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.456999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 453.00200000000007,
"heapDeltaBytes": 6249004,
"heapUsedBytes": 68010748,
"domNodes": -265,
"jsHeapTotalBytes": 3747840,
"scriptDurationMs": 68.713,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2017.9219999999987,
"styleRecalcs": 10,
"styleRecalcDurationMs": 5.583999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 452.375,
"heapDeltaBytes": 6136368,
"heapUsedBytes": 67004692,
"domNodes": -266,
"jsHeapTotalBytes": 4534272,
"scriptDurationMs": 67.135,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2090.88399999996,
"styleRecalcs": 69,
"styleRecalcDurationMs": 9.386999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 816.265,
"heapDeltaBytes": 2113156,
"heapUsedBytes": 64032244,
"domNodes": -267,
"jsHeapTotalBytes": 4739072,
"scriptDurationMs": 280.948,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2078.1280000000493,
"styleRecalcs": 70,
"styleRecalcDurationMs": 9.745000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 814.3629999999999,
"heapDeltaBytes": 2261644,
"heapUsedBytes": 64784932,
"domNodes": -265,
"jsHeapTotalBytes": 5001216,
"scriptDurationMs": 279.505,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3070.853999999997,
"styleRecalcs": 66,
"styleRecalcDurationMs": 11.590000000000002,
"layouts": 60,
"layoutDurationMs": 6.178999999999999,
"taskDurationMs": 979.007,
"heapDeltaBytes": 20205356,
"heapUsedBytes": 84395100,
"domNodes": 16,
"jsHeapTotalBytes": 8126464,
"scriptDurationMs": 351.97499999999997,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3077.0180000000096,
"styleRecalcs": 66,
"styleRecalcDurationMs": 10.986,
"layouts": 60,
"layoutDurationMs": 5.731,
"taskDurationMs": 969.2620000000001,
"heapDeltaBytes": 21088912,
"heapUsedBytes": 84466880,
"domNodes": 16,
"jsHeapTotalBytes": 8650752,
"scriptDurationMs": 343.833,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2004.7839999999724,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.620999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 449.10400000000004,
"heapDeltaBytes": 6888808,
"heapUsedBytes": 69799616,
"domNodes": -265,
"jsHeapTotalBytes": 5058560,
"scriptDurationMs": 66.911,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 1995.6010000000788,
"styleRecalcs": 10,
"styleRecalcDurationMs": 5.697999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 438.05899999999997,
"heapDeltaBytes": 6691208,
"heapUsedBytes": 69506244,
"domNodes": -266,
"jsHeapTotalBytes": 4796416,
"scriptDurationMs": 63.85199999999999,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 443.9069999999674,
"styleRecalcs": 48,
"styleRecalcDurationMs": 7.577,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 268.704,
"heapDeltaBytes": -11928804,
"heapUsedBytes": 57919044,
"domNodes": 22,
"jsHeapTotalBytes": 20328448,
"scriptDurationMs": 81.77900000000001,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 488.61199999998917,
"styleRecalcs": 48,
"styleRecalcDurationMs": 8.03,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 290.21799999999996,
"heapDeltaBytes": -11938344,
"heapUsedBytes": 57818068,
"domNodes": 22,
"jsHeapTotalBytes": 20590592,
"scriptDurationMs": 89.256,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "subgraph-idle",
"durationMs": 2009.1960000000313,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.095,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 314.76599999999996,
"heapDeltaBytes": 4069080,
"heapUsedBytes": 73936128,
"domNodes": 22,
"jsHeapTotalBytes": 19017728,
"scriptDurationMs": 11.473,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2020.2239999999847,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.148999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 354.026,
"heapDeltaBytes": -22542148,
"heapUsedBytes": 47183064,
"domNodes": -263,
"jsHeapTotalBytes": 18620416,
"scriptDurationMs": 11.616,
"eventListeners": -131,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1700.5739999999605,
"styleRecalcs": 77,
"styleRecalcDurationMs": 22.903,
"layouts": 16,
"layoutDurationMs": 2.394,
"taskDurationMs": 532.4979999999999,
"heapDeltaBytes": -21752244,
"heapUsedBytes": 47943068,
"domNodes": -263,
"jsHeapTotalBytes": 18620416,
"scriptDurationMs": 58.26300000000001,
"eventListeners": -133,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1673.3030000000326,
"styleRecalcs": 76,
"styleRecalcDurationMs": 26.498,
"layouts": 16,
"layoutDurationMs": 3.1139999999999994,
"taskDurationMs": 600.229,
"heapDeltaBytes": -21783540,
"heapUsedBytes": 48193676,
"domNodes": -263,
"jsHeapTotalBytes": 18620416,
"scriptDurationMs": 66.791,
"eventListeners": -133,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 866.2330000000225,
"styleRecalcs": 20,
"styleRecalcDurationMs": 23.756,
"layouts": 16,
"layoutDurationMs": 9.741,
"taskDurationMs": 608.3750000000001,
"heapDeltaBytes": 1460760,
"heapUsedBytes": 83489788,
"domNodes": 13673,
"jsHeapTotalBytes": 12058624,
"scriptDurationMs": 20.957000000000004,
"eventListeners": 2369,
"totalBlockingTimeMs": 113,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8091.987000000017,
"styleRecalcs": 251,
"styleRecalcDurationMs": 26.871999999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 2991.0899999999997,
"heapDeltaBytes": 7407224,
"heapUsedBytes": 68844496,
"domNodes": -263,
"jsHeapTotalBytes": 7098368,
"scriptDurationMs": 974.918,
"eventListeners": -113,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "viewport-pan-sweep",
"durationMs": 8102.229999999963,
"styleRecalcs": 249,
"styleRecalcDurationMs": 23.263,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 2780.482,
"heapDeltaBytes": 24842768,
"heapUsedBytes": 85596576,
"domNodes": -266,
"jsHeapTotalBytes": 7098368,
"scriptDurationMs": 901.202,
"eventListeners": -113,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 7881.0090000000055,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 7828.213,
"heapDeltaBytes": -24885592,
"heapUsedBytes": 174634692,
"domNodes": -8311,
"jsHeapTotalBytes": -5443584,
"scriptDurationMs": 370.384,
"eventListeners": -16388,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 7945.46200000002,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 7904.255999999999,
"heapDeltaBytes": -38824228,
"heapUsedBytes": 172468160,
"domNodes": -8311,
"jsHeapTotalBytes": -7278592,
"scriptDurationMs": 363.28799999999995,
"eventListeners": -16386,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-pan",
"durationMs": 10380.356000000007,
"styleRecalcs": 63,
"styleRecalcDurationMs": 11.565999999999994,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 10359.061,
"heapDeltaBytes": -42799292,
"heapUsedBytes": 184701924,
"domNodes": -8311,
"jsHeapTotalBytes": -16277504,
"scriptDurationMs": 642.5029999999999,
"eventListeners": -16384,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.77333333333336,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 10392.75800000007,
"styleRecalcs": 65,
"styleRecalcDurationMs": 11.911999999999978,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 10363.999,
"heapDeltaBytes": -65948464,
"heapUsedBytes": 158327140,
"domNodes": -8311,
"jsHeapTotalBytes": -12517376,
"scriptDurationMs": 695.3059999999999,
"eventListeners": -16388,
"totalBlockingTimeMs": 12,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 33.29999999999927
},
{
"name": "workflow-execution",
"durationMs": 456.1999999999671,
"styleRecalcs": 20,
"styleRecalcDurationMs": 18.4,
"layouts": 3,
"layoutDurationMs": 1.3319999999999999,
"taskDurationMs": 107.853,
"heapDeltaBytes": -15917116,
"heapUsedBytes": 52874740,
"domNodes": 156,
"jsHeapTotalBytes": 6172672,
"scriptDurationMs": 7.822000000000001,
"eventListeners": 65,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 442.5810000000183,
"styleRecalcs": 14,
"styleRecalcDurationMs": 13.864,
"layouts": 3,
"layoutDurationMs": 0.6450000000000001,
"taskDurationMs": 94.57900000000001,
"heapDeltaBytes": -16159240,
"heapUsedBytes": 52516612,
"domNodes": 121,
"jsHeapTotalBytes": 6696960,
"scriptDurationMs": 7.3210000000000015,
"eventListeners": 65,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
}
]
} |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/renderer/extensions/vueNodes/layout/useRuntimeWidgetReflow.test.ts`:
- Around line 64-83: Extend the reflow tests around mountReflow to cover both
early-return guards: mock getNode() to return null and verify no reflow work
occurs, then provide a missing layout from getNodeLayoutRef() and verify the
composable exits safely. Keep these as isolated cases and preserve the existing
unchanged-size behavior.
🪄 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: 9c5d22ba-c599-453f-9b46-270ce5e0ad0d
📒 Files selected for processing (4)
browser_tests/tests/vueNodes/widgets/runtimeWidgetReflow.spec.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vuesrc/renderer/extensions/vueNodes/layout/useRuntimeWidgetReflow.test.tssrc/renderer/extensions/vueNodes/layout/useRuntimeWidgetReflow.ts
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #13867 +/- ##
==========================================
- Coverage 78.38% 77.94% -0.45%
==========================================
Files 1685 1691 +6
Lines 100354 101621 +1267
Branches 35985 36445 +460
==========================================
+ Hits 78660 79205 +545
- Misses 21225 21929 +704
- Partials 469 487 +18
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 60 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Add isolated cases for the two early-return paths in useRuntimeWidgetReflow: getNode() returning null and getNodeLayoutRef() with no layout entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Broaden useRuntimeWidgetReflow to cover both runtime node-growth idioms that bypass the `set size` setter and so fail to reflow Vue nodes: - widget-count growth (rgthree, Easy-Use, 0246, n-nodes, mixlab, adv-latent) - image-preview size[1] growth on img.onload with no widget change (Impact-Pack, n-nodes) A bare `node.size[1] = h` write is unobservable through Vue reactivity (`_size` is a TypedArray view over a shared Rectangle buffer), so reconcile each mounted node's real size into layoutStore on a shared animation frame. Growth-only guard (isNodeLarger) keeps it a no-op except when a node actually grew and idempotent with useLayoutSync, so no feedback loop and no clobbering of a pending resize. Add DevTools DevToolsNodeRuntimeReflow node emulating both idioms and an e2e asserting the Vue node grows for each; add unit coverage for the image-preview path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Avoids any chance an unknown widget type breaks Vue-node rendering; matches the widget type the e2e used previously.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/renderer/extensions/vueNodes/layout/useRuntimeWidgetReflow.ts`:
- Around line 68-72: Update the reflow logic around isNodeLarger and resizeNode
so each committed dimension uses the maximum of the current layout size and
node.size independently, preserving existing dimensions when only the other axis
grows. Add a regression test covering mixed-axis growth to verify growth-only
updates never clobber or shrink either axis.
🪄 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: 9e1810e0-fb03-451c-95ab-7b9bc4f39ad1
📒 Files selected for processing (6)
browser_tests/tests/vueNodes/widgets/runtimeWidgetReflow.spec.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vuesrc/renderer/extensions/vueNodes/layout/useRuntimeWidgetReflow.test.tssrc/renderer/extensions/vueNodes/layout/useRuntimeWidgetReflow.tstools/devtools/nodes/inputs.pytools/devtools/web/runtimeReflow.js
…the other Addresses CodeRabbit: when only one axis grows, commit max(node.size, layout) per axis so a wider width already in layoutStore is preserved instead of being clobbered back down. Adds a mixed-axis regression test.
…roxy Replace the useRuntimeWidgetReflow polling composable with a Proxy over LGraphNode's backing size array. Element mutations (`node.size[1] = h`) — the idiom custom nodes use to grow a node at runtime — now commit to the layout store through a shared `_sizeUpdated()`, exactly like the `set size` setter, so Vue nodes reflow without a manual resize and without an rAF poll. - get size returns a cached Proxy; index writes pass through to the backing Float64Array and trigger one layout commit, while function/length access is forwarded to the real typed array so spread, iteration and `.length` work. - _sizeUpdated() guards with isSizeEqual so an equal write-back is a no-op, and useLayoutSync applies layout->node through the setter, breaking any feedback loop (no exploding node). - Remove the composable + its LGraphNode.vue wiring; unit-test the Proxy path (element mutation -> one commit, loop-safety, typed-array semantics). The devtools emulation + e2e (both idioms) are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add adversarial-review hardening for the LGraphNode size Proxy: assert the Float64Array identity/buffer contract (instanceof, byteOffset, subarray view), that the cached Proxy stays bound to the live backing store across reassignment and element writes, that size mutations never disturb the sibling pos subarray, and that serialize() emits a plain array the Proxy never leaks into. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ble resize API Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the runtime reflow E2E out of widgets/ (it tests node-level size reflow, not a widget) into vueNodes/layout/runtimeNodeReflow.spec.ts, mirroring the nodeSizeReflow unit test's layout domain. Extract the node setup and client-side growth triggers into a fixtures/utils helper so the spec holds only tests, and replace the inline anonymous evaluate types with a named RuntimeReflowNode type. Drop the repo-external migration-plan path from the size-Proxy TODO, keeping the intent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rename ONE_PX_PNG -> ONE_PIXEL_PNG, extract resizeViaDirectSizeMutation so the intent is in the name, pare the ecosystem comment to one concise note, mark the added widget as incidental (and an example of a widget whose identity is not in the node schema), and drop the inert eslint-disables (tools/**/*.js is not ESLint-covered). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
node.size.set/fill/copyWithin/reverse/sort mutate the backing Float64Array without hitting the Proxy set trap, so they skipped the layout commit and reproduced the stale-height bug via a different path. Route those methods through _sizeUpdated. Uses a module-level Set (not a static member) to avoid making the class nominal and breaking LGraphNodeConstructor comparisons. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace step-describing comments with the message arg of expect(...) so the intent shows in test logs. Add regression coverage for sequential dual-axis bare-element writes and for in-place TypedArray size mutation. Narrow resizeCommits() to ResizeNodeOperation[] via a type guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for the review @DrJKL — and for Deep's notes. Pushed the follow-ups (6ed7d4e, 0dcabd5, 93eb23c):
Also addressed the two CodeRabbit findings in the same pass: in-place TypedArray size mutations ( |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/lib/litegraph/src/LGraphNode.ts`:
- Around line 565-568: Update the proxy apply wrapper in LGraphNode to return
the proxy receiver whenever a fluent typed-array mutator’s result equals the
backing target, while preserving other return values and calling _sizeUpdated().
Add a regression test covering a fluent mutator followed by an indexed write,
verifying the size update is triggered.
🪄 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: 6c9ea1da-240e-4d47-8a47-12f8d52acdaf
📒 Files selected for processing (4)
browser_tests/tests/vueNodes/layout/runtimeNodeReflow.spec.tssrc/lib/litegraph/src/LGraphNode.tssrc/renderer/extensions/vueNodes/layout/nodeSizeReflow.test.tstools/devtools/web/runtimeReflow.js
fill/copyWithin/reverse/sort return the backing Float64Array, so a chained index write (node.size.fill(160)[1] = 180) went through the raw array and skipped the commit. Return the Proxy receiver when a mutator's result is the backing target so the chained write still routes through the set trap. Adds a regression test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/lib/litegraph/src/LGraphNode.ts`:
- Around line 557-561: Update the size proxy getter around the existing
MUTATING_SIZE_METHODS handling so subarray() results are wrapped with the same
proxy handler before being returned. Ensure mutations through the shared
typed-array view trigger _sizeUpdated(), while preserving the current binding
behavior for other methods.
🪄 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: 7f872423-d542-4ebe-9df4-c933fd80273d
📒 Files selected for processing (2)
src/lib/litegraph/src/LGraphNode.tssrc/renderer/extensions/vueNodes/layout/nodeSizeReflow.test.ts
|
@christian-byrne Successfully backported to #14016 |
|
@christian-byrne Successfully backported to #14017 |
DrJKL
left a comment
There was a problem hiding this comment.
Parallel PR review — verdict: correct, ship after comment/test cleanup
The fix is sound. Verified against the codebase: no correctness bug (_size is a stable subarray(2,4) view, never reassigned, so the cached Proxy can't go stale), backward-compat preserved (the get trap's Reflect.get(target, prop, target) keeps instanceof Float64Array, .buffer, .byteOffset, .subarray, spread and serialize() intact), and no feedback loop (useLayoutSync assigns the store's current value, short-circuited by the isSizeEqual guard before resizeNode).
Inline comments below — 1 HIGH (speculative comment block), 1 MED (test bloat), the rest LOW polish. Two committable suggestions included.
Two nits that can't anchor to changed lines:
tools/devtools/nodes/inputs.py—__all__omitsNodeRuntimeReflow(registration works viaNODE_CLASS_MAPPINGS; pre-existing drift shared by sibling nodes, no functional impact).tools/devtools/web/runtimeReflow.js:25-26— the "widget is incidental…" 2-line comment is the same justification-noise pattern; could drop.
| /** | ||
| * A Proxy over {@link _size} so that element mutations (`node.size[1] = h`) — | ||
| * the idiom many custom nodes use to grow a node at runtime — commit to the | ||
| * layout store, exactly like assigning `node.size = [w, h]`. Without this a | ||
| * bare element write bypasses the setter and a Vue node keeps its stale | ||
| * height until a manual resize. | ||
| * | ||
| * The Proxy is created once and reused; index writes pass straight through to | ||
| * the backing `Float64Array`, and function/length access is forwarded to the | ||
| * real typed array so spread, iteration and `.length` keep working. In-place | ||
| * mutating methods ({@link MUTATING_SIZE_METHODS}) also commit, so growing the | ||
| * node via `node.size.set(...)` reflows just like a bare element write. | ||
| * | ||
| * TODO(litegraph-stable-resize-api): this Proxy is the deprecation on-ramp for | ||
| * a stable resize API that does not exist yet. Its set trap already commits the | ||
| * legacy `node.size[1] =` idiom through `resizeNode` — the SAME layout-store | ||
| * primitive the sanctioned future API will call. Direction / migration: target | ||
| * end-state is a `Comfy.Node.Resize` command + `NodeHandle.setSize()`/ | ||
| * `autosize()`/`on('resize')` (v2 extension handles). Once that API lands, emit | ||
| * a one-time `warnDeprecated` from this trap naming the sanctioned call, turning | ||
| * direct element writes into a migrate-me signal instead of a silent shim (the | ||
| * deliberate fast-follow — no runtime warn today). | ||
| */ |
There was a problem hiding this comment.
HIGH — speculative comment block. The TODO(litegraph-stable-resize-api) block (~9 lines) narrates a future API that doesn't exist (Comfy.Node.Resize, NodeHandle.setSize()/autosize()/on('resize'), a future warnDeprecated). Per the repo comment policy (no ceiling/history notes; "solve the problem you know needs to be solved now"), trim to a contract:
| /** | |
| * A Proxy over {@link _size} so that element mutations (`node.size[1] = h`) — | |
| * the idiom many custom nodes use to grow a node at runtime — commit to the | |
| * layout store, exactly like assigning `node.size = [w, h]`. Without this a | |
| * bare element write bypasses the setter and a Vue node keeps its stale | |
| * height until a manual resize. | |
| * | |
| * The Proxy is created once and reused; index writes pass straight through to | |
| * the backing `Float64Array`, and function/length access is forwarded to the | |
| * real typed array so spread, iteration and `.length` keep working. In-place | |
| * mutating methods ({@link MUTATING_SIZE_METHODS}) also commit, so growing the | |
| * node via `node.size.set(...)` reflows just like a bare element write. | |
| * | |
| * TODO(litegraph-stable-resize-api): this Proxy is the deprecation on-ramp for | |
| * a stable resize API that does not exist yet. Its set trap already commits the | |
| * legacy `node.size[1] =` idiom through `resizeNode` — the SAME layout-store | |
| * primitive the sanctioned future API will call. Direction / migration: target | |
| * end-state is a `Comfy.Node.Resize` command + `NodeHandle.setSize()`/ | |
| * `autosize()`/`on('resize')` (v2 extension handles). Once that API lands, emit | |
| * a one-time `warnDeprecated` from this trap naming the sanctioned call, turning | |
| * direct element writes into a migrate-me signal instead of a silent shim (the | |
| * deliberate fast-follow — no runtime warn today). | |
| */ | |
| /** | |
| * Proxy over {@link _size} so bare element writes (`node.size[1] = h`) and | |
| * in-place mutators ({@link MUTATING_SIZE_METHODS}) commit to the layout | |
| * store like `set size` — a runtime grow otherwise leaves the Vue node | |
| * stale until a manual resize. | |
| */ |
There was a problem hiding this comment.
Addressed in follow-up #14025 (#13867 is already merged + backported, so this lands separately). Trimmed the TODO(litegraph-stable-resize-api) block to a one-line intent pointer — kept the "interim shim, remove once a stable resize API replaces direct typed-array size access" contract, dropped the enumeration of the not-yet-existing Comfy.Node.Resize / NodeHandle methods (that API is #13929, still draft).
| expect(detached.size[1]).toBe(500) | ||
| }) | ||
|
|
||
| it('keeps typed-array semantics through the size Proxy', () => { |
There was a problem hiding this comment.
MEDIUM — tests exercise language mechanics, not the fix. These cases assert the ECMAScript TypedArray/Proxy spec rather than reflow behavior (AGENTS.md flags change-detector tests). Consider cutting: this one (keeps typed-array semantics), L152 (buffer contract: BYTES_PER_ELEMENT/byteOffset), L170 (cached Proxy … live backing store), L184 (sibling pos subarray), and L117 (fluent TypedArray mutator, fill()[1]= — an idiom nobody ships). The 4 behavioral cases (widget-growth size[1]=, feedback-loop no-op guard, in-place .set(), detached-node no-commit) + the serialize()-no-leak regression already cover the bug.
There was a problem hiding this comment.
Addressed in #14025. Cut the five spec-mechanics change-detector cases you flagged — keeps typed-array semantics, buffer contract, cached Proxy … live backing store, sibling pos subarray, and the fluent fill()[1]= mutator. Kept the behavioral suite: single-commit grow, per-axis sequential writes, whole-array assign, no-feedback-loop guard, in-place .set(), detached no-commit, and the serialize()-no-leak regression.
| private _sizeUpdated(): void { | ||
| if (this.id === UNASSIGNED_NODE_ID || !this.graph) return | ||
|
|
||
| const size = { width: this._size[0], height: this._size[1] } | ||
| const layout = layoutStore.getNodeLayoutRef(this.id).value | ||
| if (layout && isSizeEqual(layout.size, size)) return | ||
|
|
||
| const mutations = useLayoutMutations() | ||
| mutations.setSource(LayoutSource.Canvas) | ||
| mutations.resizeNode(this.id, { | ||
| width: value[0], | ||
| height: value[1] | ||
| }) | ||
| mutations.resizeNode(this.id, size) |
There was a problem hiding this comment.
LOW (perf, write-path). Two easy allocations per committed resize:
useLayoutMutations()rebuilds a 14-closure object every call — hoistable to module scope (it only captureslayoutStore). Same pattern inset pos(L518).- The
isSizeEqualguard readsgetNodeLayoutRef(id).value, which allocates a freshNodeLayoutviayNodeToLayout;resizeNodethen reads.valueagain → twoNodeLayoutallocations per resize.
Write-path only (drag-resize / autogrow), not the render hot path — low priority.
There was a problem hiding this comment.
Addressed the hoist in #14025 — useLayoutMutations() is now a module-scope const (it captures only the layoutStore singleton) reused in both set pos and _sizeUpdated. Left the second sub-point (the two NodeLayout allocations from the isSizeEqual guard + resizeNode both reading getNodeLayoutRef(id).value) as-is for now — write-path only, low priority.
| // Assign through the setter so both axes update together. The setter's | ||
| // isSizeEqual guard makes this write-back a no-op commit (the value now | ||
| // equals the layout), so no feedback loop through handleLayoutChange. |
There was a problem hiding this comment.
LOW. 3-line justification comment on a 1-line change (comment policy: "a one-line fix does not need a three-line comment"). Net-neutral since it replaced a similar block, so optional — a single line ("setter's isSizeEqual guard no-ops this equal write-back") would suffice.
There was a problem hiding this comment.
Addressed in #14025 — collapsed to one line: // The setter's isSizeEqual guard no-ops this equal write-back.
| const graph = window.graph as unknown as TestGraphAccess | ||
| const node = graph._nodes_by_id[id] as unknown as RuntimeReflowNode |
There was a problem hiding this comment.
LOW. Double as unknown as here. Acceptable at the page.evaluate boundary (litegraph AGENTS permits assertions as a last resort for interop), and the types are properly declared in globals.d.ts — just flagging, no change required.
There was a problem hiding this comment.
Left as-is per your note — the double as unknown as at the page.evaluate boundary is acceptable interop and the types are declared in globals.d.ts. No change in #14025.
| const img = new Image() | ||
| img.onload = () => { | ||
| this.imgs = [img] | ||
| resizeViaDirectSizeMutation(this, Math.max(this.size[1] + 120, 200)) |
There was a problem hiding this comment.
LOW. Math.max(…, 200) is dead — any starting height + 120 already exceeds 200.
| resizeViaDirectSizeMutation(this, Math.max(this.size[1] + 120, 200)) | |
| resizeViaDirectSizeMutation(this, this.size[1] + 120) |
There was a problem hiding this comment.
Addressed in #14025 — dropped the dead Math.max(…, 200); now resizeViaDirectSizeMutation(this, this.size[1] + 120).
Fixes #13863
Problem
Custom nodes grow a node at runtime by writing
node.size[1]directly (anelement mutation) and calling
setDirtyCanvas(...), instead of going throughnode.setSize()/ theset sizesetter. On Vue Nodes the node keeps its oldheight until the user manually resizes it.
Root cause: a Vue node's geometry is owned by
layoutStore. The only litegraphpath that mirrored height into
layoutStorewas theset sizesetter. Adirect
node.size[1] = ...element mutation bypassed the setter, andsetDirtyCanvasis a no-op for Vue nodes, so the store never learned the newheight. This is a copy-pasted idiom, not one pack's quirk — two variants hit
the seam:
addCustomWidget(...)thennode.size[1] = ...:rgthree Power Lora Loader, yolain ComfyUI-Easy-Use, comfyui-0246,
ComfyUI-N-Nodes, comfyui-mixlab-nodes, comfyui-advanced-latent-control.
img.onload,node.imgs = [...]; node.size[1] = Math.max(200, ...): ltdrdataComfyUI-Impact-Pack, ComfyUI-N-Nodes.
Fix
Intercept the size mutation directly.
get sizereturns a cachedProxyoverthe node's backing
_sizearray whosesettrap commits the new size tolayoutStorethrough a shared_sizeUpdated()— the same path theset sizesetter now uses. So both
node.size = [w, h]and the element-mutation idiomsnode.size[0] = w/node.size[1] = hreflow the Vue node, with no polling andno per-pack fix.
The Proxy is created once per node and reused. Index writes pass straight
through to the backing
Float64Array; function andlengthaccess is forwardedto the real typed array, so spread, iteration and
.lengthkeep working, andserialization is unaffected (it reads
size[0]/size[1]into a plain array).Loop safety (no exploding node):
_sizeUpdated()commits only when the sizeactually changed (
isSizeEqualguard), taggedLayoutSource.Canvas. Thelayout → litegraph write-back in
useLayoutSyncapplies the value through thesetter, so when it re-applies the size the node already holds, the guard makes
it a no-op — no feedback loop through
handleLayoutChange.This replaces the earlier
useRuntimeWidgetReflowreconcile-on-animation-frameshim; the mutation itself now commits, so the poll is gone.
// TODO(litegraph-stable-resize-api): remove the Proxy once litegraph exposesa public resize/commit API that custom nodes call instead of mutating
node.size[1]directly.Tests
nodeSizeReflow.test.ts(unit): a singlesize[1]=element mutation commitsexactly one
resizeNodetolayoutStore; the setter commits once; an equalwrite-back does not re-commit (loop-safe); typed-array semantics (spread,
Array.from,.length) survive the Proxy; no commit before the node joins agraph.
Node Runtime Reflownode emulates both idioms on the client(
growByWidget()andgrowByPreview()).runtimeWidgetReflow.spec.ts(e2e,@vue-nodes): the rendered node heightgrows for BOTH triggers with no manual resize.
Direction / migration
This Proxy is not a dead-end shim — it is the deprecation on-ramp for a stable resize API that does not exist yet. Its
settrap already commits the legacynode.size[1] =idiom throughresizeNode, the same layout-store primitive the sanctioned future API will call.Target end-state (see
research/architecture/toward-new-api-plan.md§2, follow-ups A2/A3/A4):Comfy.Node.Resizecommand +NodeHandle.setSize()/autosize()/on('resize')(v2 extension handles) that custom nodes call instead of mutatingnode.size[1].resizeNode(nodeId, size, source)primitive — no second write path.Once that API lands, this trap should emit a one-time
warnDeprecatednaming the sanctioned call — turning direct element writes into a migrate-me signal rather than a silent shim (the array-element equivalent ofdefineDeprecatedProperty). That runtime warn is a deliberate later fast-follow (A4), intentionally not in this PR. Ecosystem gap rows:S2.N19/S10.D3/S11.G4.