chore(playground): Restore Form.Item single child in the connection wizard - #11841
Conversation
The oxlint migration (#11790) unrolled the nested ternary picking the input control into three sibling `&&` expressions inside `<Form.Item name={param.env}>`. antd 4.16 only injects `value`/`onChange` when `isValidElement(children)` holds; with an array it warns and renders the children untouched, leaving every wizard input unbound from the form. Two Cypress birdbox tests have been red on master since that commit: | Test | Symptom | | --- | --- | | `copies values of the localhost tip box` | `form.setFieldsValue({ CUBEJS_DB_HOST })` never reached the input, so the assertion saw an empty value instead of `host.docker.internal` | | `PostgreSQL connection flow -- connects to the DB` | typed credentials never landed in form state, so submit posted empty values and the error alert never cleared | Move the control selection into a `DatabaseFormControl` helper so `Form.Item` gets a single child again, keeping the logic identical and free of nested ternaries. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Claude finished @ovr's task in 1m 6s —— View job Review complete — 1 blocking issue: the fix does not restore form bindingFull review
Blocking — inputs remain unbound (inline)The diagnosis in the description is right: But the fix moves the problem rather than removing it. Concrete failure: both Cypress specs named in the description should still be red.
Secondary: passing a The inline comment carries a suggested patch — turn Other observations
I could not run the linter or Cypress either — this checkout has no installed |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11841 +/- ##
==========================================
+ Coverage 60.16% 60.22% +0.05%
==========================================
Files 239 239
Lines 19206 19177 -29
Branches 3886 3881 -5
==========================================
- Hits 11556 11550 -6
+ Misses 7100 7077 -23
Partials 550 550
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…input The previous commit moved the control selection into a `DatabaseFormControl` component, which did not fix anything: `Form.Item` clones its single child and injects `value`/`onChange`, so those props landed on the wrapper component, which dropped them, and the `<Input>` stayed unbound exactly as before. Call the helper during render instead, so `Form.Item` receives the `<Input>` element itself. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Claude finished @ovr's task in 1m 5s —— View job Re-review after
|
param |
pre-#11790 | head |
|---|---|---|
no title |
Input.TextArea rows={1}, overflow: hidden, resize: none |
same |
title, env === 'CUBEJS_DB_PASS' |
Input.Password |
same |
title, other |
Input |
same |
data-testid={param.env} is present on all three branches (:10, :21, :24) — that matters, since the birdbox specs select by it. The nested ternary that #11790 objected to is gone, replaced by early returns in a named helper, so the oxlint motivation still holds.
That should un-red both specs named in the description: copies values of the localhost tip box (the Input now reads injected value, so form.setFieldsValue({ CUBEJS_DB_HOST }) becomes visible) and PostgreSQL connection flow -- connects to the DB (keystrokes reach the injected onChange, so onFinish posts real credentials). Reasoning from the cloning contract, not a live run — this checkout has no node_modules, so I could run neither oxlint nor Cypress. The birdbox suite is the acceptance criterion; please confirm it goes green before merge. CI on this head is still in progress at the time of writing.
Low
- Stale PR description. The body still describes the fix as "moves the control selection into a
DatabaseFormControlhelper", which was the first commit's approach. Worth a one-line edit before merge so the merge commit message matches the code (databaseFormControl(param), a function returning the element — not a component). paramis untyped (implicitany) in a.tsxfile. Consistent with the surroundingDatabaseFormprops, which are also untyped, so not worth churning in a CI-unblocking PR — just noting it if anyone types this file later.
Other observations
- Extracting the helper above the component (module scope, not re-created per render) is the right call — a nested definition would allocate a new function identity each render for no benefit.
- No new tests needed, as the description says: existing Cypress coverage exercises all three control branches.
- No security or performance implications; the change is render-local with no new data flow.
- Resolved my one prior inline thread — the concern no longer applies to the current diff.
Check List
Description of Changes Made (if issue reference is not provided)
The oxlint migration (#11790) unrolled the nested ternary that picks the input control into three sibling
&&expressions inside<Form.Item name={param.env}>, and antd 4.16 only injectsvalue/onChangewhenisValidElement(children)holds — with an array it warns and renders the children untouched, leaving every connection wizard input unbound from the form. That has kept two Cypress birdbox tests red on master since that commit:copies values of the localhost tip box(the tip box'sform.setFieldsValue({ CUBEJS_DB_HOST })never reached the input) andPostgreSQL connection flow -- connects to the DB(typed credentials never landed in form state, so submit posted empty values and the error alert never cleared). This moves the control selection into aDatabaseFormControlhelper soForm.Itemgets a single child again, with identical logic and no nested ternary. Existing Cypress coverage already exercises both paths, so no new tests were needed; I could not run the linter or Cypress locally because this worktree has no installednode_modules.🤖 Generated with Claude Code