fix(widgets): collapse duplicate COLOR widget rendering on Color to RGB Int (FE-842)#12447
fix(widgets): collapse duplicate COLOR widget rendering on Color to RGB Int (FE-842)#12447dante01yoon wants to merge 2 commits into
Conversation
…GB Int Two color widgets render side-by-side for nodes whose backend declares a single `Color.Input`. The visible cause is that `node.widgets` ends up with two same-name color widgets at runtime, but `useProcessedWidgets` only dedupes promoted / execution-scoped widgets — for regular root-graph widgets `dedupeIdentity` was always `undefined`, so duplicates fell through to two `<WidgetColorPicker>` instances. Two defensive fixes: 1. `getWidgetIdentity` now falls back to the host `nodeId` parameter when neither `storeNodeId/widget.nodeId` nor `sourceExecutionId` are available, so identical normal widgets on the same node collapse to one render. `sourceExecutionId` precedence is preserved. 2. `useColorWidget` honors the V2 top-level `default` and short-circuits if a same-name color widget is already on the node, preventing a second `addWidget` call from upstream hooks. Fixes CORE-256
📝 WalkthroughWalkthroughAdds a host-derived fallback for widget identity used in deduplication when stable IDs are missing, introduces tests asserting the new transient/dedupe behaviors, and updates color widget logic to prefer ChangesWidget Improvements
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎨 Storybook: ✅ Built — View Storybook |
🎭 Playwright: ✅ 1637 passed, 0 failed · 2 flaky📊 Browser Reports
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #12447 +/- ##
===========================================
- Coverage 74.42% 60.18% -14.24%
===========================================
Files 1526 1416 -110
Lines 86018 72557 -13461
Branches 23699 20193 -3506
===========================================
- Hits 64016 43670 -20346
- Misses 21179 28413 +7234
+ Partials 823 474 -349
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1014 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Manual visual verification (cloud distribution)Verified locally against 1. Baseline —
2. Dedupe layer proof — force-pushed a second identical color widget into node.widgets.push(Object.assign(Object.create(Object.getPrototypeOf(existing)), existing))
// node.widgets.length === 2
Screenshots saved locally (gitignored under
Confirms the fix lands at the rendering layer regardless of where the second Quality gates: |
`Should display added widgets` was pushing the same widget reference into `node.widgets` and expecting N rendered rows. After the CORE-256 dedupe fix in `getWidgetIdentity` (which now derives a stable identity from the host nodeId for normal widgets), identical name+type entries on the same node correctly collapse to one render — exactly the bug behavior the spec was inadvertently encoding as a contract. Push shallow clones with unique names instead. This preserves the test's intent (mutating `node.widgets` updates the rendered rows) without relying on the bug we just fixed.




Summary
Fix the duplicate `` rendering on the `Color to RGB Int` node (and any other COLOR-using V3 node that the runtime double-registers a widget for).

Changes
Review Focus
Fixes FE-842