Repository navigation
Support keeping value across dynamic combo options - #8721
AustinMroz wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughWidget state preservation enhanced during dynamic reconfigurations: removed widgets are captured and matched against newly added widgets by name and type, restoring their values and callbacks when matches are found. Additionally, integer widget values now enforce min/max boundary constraints. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 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 |
🎭 Playwright Tests: ❌ FailedResults: 515 passed, 1 failed, 3 flaky, 8 skipped (Total: 527) ❌ Failed Tests📊 Browser Reports
|
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 02/07/2026, 08:58:59 PM UTC 🔗 Links🎉 Your Storybook is ready for review! |
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 22.2 kB (baseline 22.2 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 854 kB (baseline 854 kB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 69 kB (baseline 69 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 9 added / 9 removed Panels & Settings — 409 kB (baseline 409 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 11 added / 11 removed User & Accounts — 16.1 kB (baseline 16.1 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 5 added / 5 removed Editors & Dialogs — 781 B (baseline 781 B) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 1 added / 1 removed UI Components — 36.6 kB (baseline 36.6 kB) • ⚪ 0 BReusable component library chunks
Status: 5 added / 5 removed Data & Services — 2.12 MB (baseline 2.11 MB) • 🔴 +758 BStores, services, APIs, and repositories
Status: 12 added / 12 removed Utilities & Hooks — 237 kB (baseline 237 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 12 added / 12 removed Vendor & Third-Party — 8.77 MB (baseline 8.77 MB) • ⚪ 0 BExternal libraries and shared vendor chunks
Other — 7.15 MB (baseline 7.15 MB) • ⚪ 0 BBundles that do not match a named category
Status: 54 added / 54 removed |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/core/graph/widgets/dynamicWidgets.ts`:
- Around line 179-190: The lint error is caused by using optional chaining with
the in operator on spec?.[1]; update the guard so the right-hand operand is a
plain property access guarded by a truthy check. In the loop over removedWidgets
where you compute spec from newSpec, replace the condition `if (spec?.[1] &&
'default' in spec?.[1]) continue` with a two-step truthy guard such as checking
`spec && spec[1]` before using `'default' in spec[1]` so that the in-operator
never receives undefined; this touches the block that assigns
newMatchingWidget.value and calls newMatchingWidget.callback.
| for (const widget of removedWidgets) { | ||
| const newMatchingWidget = addedWidgets.find((w) => w.name === widget.name) | ||
| if (!newMatchingWidget || newMatchingWidget.type !== widget.type) continue | ||
|
|
||
| const nameSegment = widget.name.slice(widget.name.lastIndexOf('.') + 1) | ||
| const spec = | ||
| newSpec.required?.[nameSegment] ?? newSpec.optional?.[nameSegment] | ||
| if (spec?.[1] && 'default' in spec?.[1]) continue | ||
|
|
||
| newMatchingWidget.value = widget.value | ||
| newMatchingWidget.callback?.(widget.value) | ||
| } |
There was a problem hiding this comment.
Address Biome noUnsafeOptionalChaining lint error on Line 186.
Biome flags 'default' in spec?.[1] because the in operator throws TypeError if its right-hand operand is undefined. While && short-circuiting makes this safe at runtime, the lint rule doesn't track that. Dropping optional chaining in favor of a direct truthy guard silences the warning and is arguably clearer:
Proposed fix
- const spec =
- newSpec.required?.[nameSegment] ?? newSpec.optional?.[nameSegment]
- if (spec?.[1] && 'default' in spec?.[1]) continue
+ const spec =
+ newSpec.required?.[nameSegment] ?? newSpec.optional?.[nameSegment]
+ if (spec && spec[1] && 'default' in spec[1]) continue📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| for (const widget of removedWidgets) { | |
| const newMatchingWidget = addedWidgets.find((w) => w.name === widget.name) | |
| if (!newMatchingWidget || newMatchingWidget.type !== widget.type) continue | |
| const nameSegment = widget.name.slice(widget.name.lastIndexOf('.') + 1) | |
| const spec = | |
| newSpec.required?.[nameSegment] ?? newSpec.optional?.[nameSegment] | |
| if (spec?.[1] && 'default' in spec?.[1]) continue | |
| newMatchingWidget.value = widget.value | |
| newMatchingWidget.callback?.(widget.value) | |
| } | |
| for (const widget of removedWidgets) { | |
| const newMatchingWidget = addedWidgets.find((w) => w.name === widget.name) | |
| if (!newMatchingWidget || newMatchingWidget.type !== widget.type) continue | |
| const nameSegment = widget.name.slice(widget.name.lastIndexOf('.') + 1) | |
| const spec = | |
| newSpec.required?.[nameSegment] ?? newSpec.optional?.[nameSegment] | |
| if (spec && spec[1] && 'default' in spec[1]) continue | |
| newMatchingWidget.value = widget.value | |
| newMatchingWidget.callback?.(widget.value) | |
| } |
🧰 Tools
🪛 Biome (2.3.13)
[error] 186-186: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
🤖 Prompt for AI Agents
In `@src/core/graph/widgets/dynamicWidgets.ts` around lines 179 - 190, The lint
error is caused by using optional chaining with the in operator on spec?.[1];
update the guard so the right-hand operand is a plain property access guarded by
a truthy check. In the loop over removedWidgets where you compute spec from
newSpec, replace the condition `if (spec?.[1] && 'default' in spec?.[1])
continue` with a two-step truthy guard such as checking `spec && spec[1]` before
using `'default' in spec[1]` so that the in-operator never receives undefined;
this touches the block that assigns newMatchingWidget.value and calls
newMatchingWidget.callback.
Dynamic Combos will sometimes have options with a level of overlap, either because they differ in options (min/max) or they're only common on a portion of the Dynamic Combo options. This PR provides a means for these shared widgets to maintain there value across option group selections.
TODO
┆Issue is synchronized with this Notion page by Unito