Repository navigation
Fixes #37771: clear React Aria controlled props with null, and lint for it - #37772
Conversation
…ared
OMSelectWidget passed selectedKey={undefined} to Select.ComboBox for an
empty value, which hands the selection to React Aria. Clearing the input
then looped between its state and the query builder's until React threw
"Maximum update depth exceeded". Pass null, as the sync Select already does.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
…or it The same undefined fallback that crashed the async select also sat on the query builder field select, the form radio widget, the service environment select and the service agents sub-tabs. Each now passes its empty controlled value. A new ESLint rule, openmetadata-ui-patterns/no-undefined-controlled-prop, fails a literal undefined fallback on a controlled prop, and the decision record states the rule for the cases the lint cannot see.
Code Review ✅ Approved 🟡 Medium riskChanging React Aria empty-value handling across selects, tabs, and form fields, with a new lint rule, could alter UI state when controls are cleared. Fixes the "Maximum update depth exceeded" crash when clearing an async query builder select by passing VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🤖 Backport to |
|
🤖 Backport to |
…or it (#37772) (#37781) * Fixes #37771: keep the async query builder select controlled when cleared OMSelectWidget passed selectedKey={undefined} to Select.ComboBox for an empty value, which hands the selection to React Aria. Clearing the input then looped between its state and the query builder's until React threw "Maximum update depth exceeded". Pass null, as the sync Select already does. * Fixes #37771: clear React Aria controlled props with null, and lint for it The same undefined fallback that crashed the async select also sat on the query builder field select, the form radio widget, the service environment select and the service agents sub-tabs. Each now passes its empty controlled value. A new ESLint rule, openmetadata-ui-patterns/no-undefined-controlled-prop, fails a literal undefined fallback on a controlled prop, and the decision record states the rule for the cases the lint cannot see. * Format the no-undefined-controlled-prop rule and its tests (cherry picked from commit 8a03f70)
Describe your changes:
Fixes #37771
Clearing the value of an async query builder select in one go (Cmd+Delete, or select-all + Delete) crashed the page with "Maximum update depth exceeded".
Cause.
OMSelectWidgetpassedselectedKey={undefined}toSelect.ComboBoxwhen the value was empty. React Aria treatsundefinedas uncontrolled, so the moment the value emptied the component took over its own selection, and its state and the query builder's kept correcting each other until React gave up.nullis React Aria's controlled empty value.Same pattern elsewhere. I swept OpenMetadata UI, core components and Collate UI for controlled props (
selectedKey,selectedKeys,inputValue,isOpen,isSelected,expandedKeys,valueon React Aria fields) that can flip toundefined. This PR fixes the OpenMetadata ones:utils/queryBuilderWidgets/OMSelectWidget.tsxselectedKey={… : undefined}: null(the crash)utils/queryBuilderWidgets/OMFieldSelect.tsxselectedKey={selectedKey ?? undefined}?? nullcomponents/common/FormBuilderV1/widgets/CoreRadioWidget.tsxvalue={… ? undefined : String(value)}? null(matchesCoreSelectWidget)components/Settings/Services/ServiceAttributes/ServiceAttributesCard.tsxvalue={draft.environment}(optional field)?? nullcomponents/Settings/Services/Ingestion/Ingestion.component.tsxselectedKey={subTab}(route param, absent on the default sub-tab)subTab ?? ServiceAgentSubTabs.METADATACopyToClipboardButton'sisOpen={hasCopied || undefined}flips on purpose (it forces the tooltip open after a copy and otherwise leaves hover to React Aria), so it keeps the pattern with the reason and a line-level disable.Guard. New ESLint rule
openmetadata-ui-patterns/no-undefined-controlled-prop(error) fails a JSX controlled prop on a component whose expression falls back to a literalundefined/void 0(ternary branch,??,||). After this PR it reports zero findings across OpenMetadata UI and core components. It cannot see a variable whose type includesundefined(two of the fixes above were that shape), so the record states the rule for review.Decision record:
ADR:2026-11-13-react-aria-controlled-props-are-cleared-with-null-not-undefined, with a one-line pointer in.claude/rules/component-library.md.Not changed: the core
DatePicker/DateRangePickerhandvaluestraight touseControlledState, so a caller passingundefinedwould flip them too. No caller does today, and coercingundefined→nullinside the wrapper would break callers that are deliberately uncontrolled.Type of change:
High-level design:
N/A — small fixes plus one lint rule.
Tests:
Use cases covered
Unit tests
OMSelectWidget.test.tsx:keeps the async select controlled when its value is cleared— fails on the old code, passes with the fix.eslint-rules/openmetadata-ui-patterns.test.mjs: 6 valid / 5 invalid cases for the new rule (58/58 in the file pass).utils/queryBuilderWidgets,Settings/Services/Ingestion,Settings/Services/ServiceAttributes,common/FormBuilderV1,common/CopyToClipboardButton: all pass exceptIngestionListTable.test.tsx, which fails identically on unmodifiedmainin my checkout (Cannot find module '@tiptap/react/menus', a local install gap).exhaustive-depswarnings).check_decision_records.py: clean.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Visual regression baselines
Manual testing performed
Collate UI dev server on latest main against a local 2.0.0-SNAPSHOT server with sample data:
ServiceIselasticsearch_sample. Select all + Delete in the value: before, "Maximum update depth exceeded"; after, the field clears,samplelists services, pickingsample_airflowupdates the count to 12 assets.Tier: switches with no error.sample_dataservice → Agents: Metadata selected on open, three Metadata ↔ Collate AI round trips, Back returns to Summary; no page errors or controlled/uncontrolled warnings.CoreRadioWidgetandServiceAttributesCardare covered by their unit suites only.UI screen recording:
Not applicable — bug fix with no new UI. Before/after clips of step 1 are attached in a comment below.
before.mp4
after.mp4
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.docs/decisions/2026-11-13-react-aria-controlled-props-are-cleared-with-null-not-undefined.md.🤖 Generated with Claude Code