Uh oh!
There was an error while loading. Please reload this page.
feat(fields): RadioField visibleWhen cascading + dependsOn gating; single-source the option resolver - #2728
Merged
Merged
Conversation
…ngle-source the option resolver Brings `RadioField` to parity with `SelectField` / `MultiSelectField` for ADR-0058 cascading & role-gated options (the same gap #2715 fixed for multiselect), and collapses the three copies of the gate-then-filter logic onto one shared resolver. - @object-ui/core: new pure `resolveCascadingOptions(rawOptions, record, dependsOn, scope)` → `{ options, gated, dependsOnFields }` — the single source of truth for `dependsOn` gating + per-option `visibleWhen` filtering. Unit tested. - @object-ui/fields: `RadioField` narrows offered radios against the live record + `current_user`, gates behind a "select the parent first" hint while a `dependsOn` field is empty, and clears a value no longer offered (scalar cascade clear). `useCascadingOptions` refactored to a thin React wrapper over the core helper. New `RadioField.cascade.test.tsx`. - @object-ui/components: the form renderer's inline option pre-filter and cross-field cascade-clear effect now call `resolveCascadingOptions` instead of re-deriving gating/filtering, so they can't drift from the widgets (no behavior change; `form-cascading-select` tests stay green). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. |
3 tasks
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2717 (multiselect parity). Brings
RadioFieldto full parity withSelectField/MultiSelectFieldfor ADR-0058 cascading & role-gated options, and removes the duplicated gate-then-filter logic.Why
CASCADE_OPTION_FIELD_TYPESalready listsradio, and the object form pre-filters its options — but the standaloneRadioFieldwidget renderedconfig.optionsraw, so outside the form renderer (inline grid editor,ActionParamDialog) aradiowith dependent / role-gated options showed the unfiltered set. Exactly the gap #2709→#2715 closed for multiselect.While here, the
gated ? [] : resolveVisibleOptions(...)pattern lived in three places (the widgets' hook + two sites inform.tsx) — a drift risk. Collapsed onto one pure core helper.Changes
@object-ui/core— new pureresolveCascadingOptions(rawOptions, record, dependsOn, scope)→{ options, gated, dependsOnFields }, the single source of truth fordependsOngating +visibleWhenfiltering (unit tested).@object-ui/fields—RadioFieldnarrows offered radios against the live record +current_user, gates behind a "select the parent first" hint, and clears a value no longer offered (scalar cascade clear). Addsradio-empty-*/radio-option-*testids.useCascadingOptionsis now a thin React wrapper over the core helper.@object-ui/components—form.tsx's inline option pre-filter and the cross-field cascade-clear effect callresolveCascadingOptionsinstead of re-deriving gating/filtering. No behavior change — human-label gate hint preserved.Tests
RadioField.cascade.test.tsxmirrorsSelectField.cascade.test.tsx(gating, scalar cascade clear, role/context gating).resolveCascadingOptionsunit coverage added.optionRules+ componentsform-cascading-select&form-dependent-values(the refactored form path) + fieldsRadioField.cascade/MultiSelectField.cascade/SelectField.cascade/standard-widgets.tsc --noEmitclean for@object-ui/core,@object-ui/components,@object-ui/fields;eslint0 errors.Refs
Note: client-side hiding remains UX only — server-side rejection of gated option values is tracked separately (icebox).
🤖 Generated with Claude Code