Repository navigation
feat(form): the record form names a visibleWhen clear-on-hide (objectui#8070) - #10598
Conversation
The objectui#6958 clear now raises one notice under the form's outcome-toast id naming the cleared fields' labels, joined by the locale's validation.formInvalidJoiner. New key form.clearedOnHide in the form.tsx fallback table and in every pack. Claude-Session: https://claude.ai/code/session_01KUxVUa7e39aNjhkKi1gsoy Co-authored-by: Claude <noreply@anthropic.com>
…d it A clear can hide a second field whose visibleWhen reads the field just cleared; that clear runs on the next pass and used to replace the notice with the second field alone. A pass that starts from exactly the values the previous clearing pass left behind now names its fields with that pass's; any edit in between starts a fresh list. Claude-Session: https://claude.ai/code/session_01KUxVUa7e39aNjhkKi1gsoy Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KUxVUa7e39aNjhkKi1gsoy Co-authored-by: Claude <noreply@anthropic.com>
…e-visiblewhen-clear
Claude-Session: https://claude.ai/code/session_01KUxVUa7e39aNjhkKi1gsoy Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KUxVUa7e39aNjhkKi1gsoy Co-authored-by: Claude <noreply@anthropic.com>
`false` is a two-state control's empty state (BOOLEAN_WIDGET_TYPES; a create form seeds it), so hiding an untouched checkbox raised a notice about a box that reads unchecked before and after. Only a field that held something is named now; a checked one still is. Claude-Session: https://claude.ai/code/session_01KUxVUa7e39aNjhkKi1gsoy Co-authored-by: Claude <noreply@anthropic.com>
|
changeset-claim-re-read
|
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
…announces Claude-Session: https://claude.ai/code/session_01KUxVUa7e39aNjhkKi1gsoy Co-authored-by: Claude <noreply@anthropic.com>
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
Contract reviewServed-tier: Reviewed against merge-base ① Derived judgmentsBinding text. Ruling 5749200153 (letter A, ratified 5809913547): "The record form names the clear: after a Behaviour changes, each judged.
Not asked / beyond the claim's surface. (a) The docs edit is outside the claim's declared file surface, but AGENTS.md #2 ("Not done until docs reflect the code") makes it owed, and Missing. Nothing. Notice, why-clause, id sharing, all ten packs, reader, pin (both halves), changeset, docs: all present. Existing pins edited or deleted. None. Can the new pin fail?
② Semver level
Changeset prose, sentence by sentence.
Docs prose added,
The added ③ Boundary flags
Implemented-by: VERDICT: PASS |
Fixes #8070
Clause-②: no
What this does
The record form now names the objectui#6958 clear-on-hide. This applies ruling 5749200153 (letter A, ratified by the maintainer at 5809913547) at its default placement: one form-level notice under the form's existing outcome-toast id. The clear itself is unchanged. It is the same loop, skipping the same values and writing the same values.
packages/components/src/renderers/form/form.tsx, in the clear-on-hide effect (the one that keepspreviouslyHiddenFieldNames): the loop that clears now also collects what it cleared and raises onetoast.warningwitht('form.clearedOnHide', …)underoutcomeToastId. It names fields byfieldLabelByName, the same label sourcevalidation.formInvaliduses, joined byt('validation.formInvalidJoiner'). TheuseSafeFormTranslationfallback table carries theenrow, wired likeform.submitFailed.packages/i18n/src/locales/*.ts: one key,form.clearedOnHide, in all ten packs, placed afteruploadInFlightin eachformblock.packages/components/src/renderers/form/__tests__/visiblewhen-clear-notice-8070.test.tsx, beside the objectui#6958 pin. That pin is byte-unchanged (git diff --quietagainst BASE8740e86exits 0) and green..changeset/8070-name-visiblewhen-clear.md, a patch for@object-ui/componentsand@object-ui/i18n.Register:
warning. Nothing failed, so it is noterror. It is notinfoeither, because the value leaves the record when the form is saved.Two rules sit on top of "name what the pass clears". Each has its own pin leg and its own ablation below.
falseon a two-state control is not named either:BOOLEAN_WIDGET_TYPESin the same file definesfalseas that control's EMPTY state, and a create form seeds it. Without this rule, hiding an untouched checkbox on a create form raised a notice about a box that reads unchecked before and after (measured with a probe:notices= ["Cleared — no longer applicable given the current values: Priority Support"]). A checked box is still named. The clear still writesnulloverfalseexactly as before.visibleWhenreads the field just cleared, and that second clear runs on the next pass. Suppose a pass starts from exactly the values the previous clearing pass left behind, compared with the file's owncomputeDirty. Then nothing was edited in between: the second pass is part of the same cascade. It names its fields together with the first pass's. Any edit in between starts a fresh list, and that case is pinned too.PM mechanism hypotheses: readings
4c23e90), the chained leg failed withTests 1 failed | 9 passed (10)and receivedCleared — no longer applicable given the current values: Role. Contact had been cleared and was not named. That result is the reason for rule 2. Names are still collected only in the clear's own loop, and no visibility is recomputed anywhere else.Toasterin a throwaway probe, not committed. After the transition there was 1 toast, carrying the notice text. After a client refusal there was still 1 toast, and the notice text was gone: sonner updated the toast in place. After an accepted attempt there were 0 toasts. The pin checks the same contract at the id level: the notice's id is the id of the refusal'stoast.error, and the id thattoast.dismissreceives at the next accepted attempt. The other direction: a transition while a refusal toast is showing replaces that toast with the notice. The refusal is still visible, as the client field highlights or, for a server refusal, the in-formsubmitErrorbanner. A refusal can also replace a notice the user has not read yet. That refusal comes from the user's own next Save, which is how the ruling's "retires like its siblings" reads, so no second id was introduced.validation.formInvalidJoiner, and the labels come fromfieldLabelByName(label, thenname, asvalidation.formInvaliddoes). Pinned:Contact, Roleunderen, andContact、Roleunderzh(read from the zh pack, with no,present).form.submitFailedlives in both theuseSafeFormTranslationdefaults table and each pack'sformblock, and the new key follows the same pattern.check:i18n-keysconfirms every readablecreateSafeTranslationdefaults row repeats the pack value.all-locales-key-parityis green. No count is interpolated: each value ends in a colon and the list.arandrusay "what no longer applies" (ما/то, что), so no word has to agree with the number of fields.In the table the i18next placeholder is spelled FIELDS. The tree uses the double-brace form.
Pin and reverse verification
The pin has 13 legs.
form-outcome:.enjoiner.zhis joined by U+3001.All runs used the repo root,
pnpm exec vitest runon the pin file, through the shared verify lock. The mutations went throughablation-replace.mjs, which confirmed each one landed on disk and restored the file to its HEAD blob withgit diff HEADempty.form.tsxat BASE8740e86(0 on-disk hits for the key)Tests 7 failed | 6 passed (13). The six that pass are the absence legs.8a69de7Tests 13 passed1 failed | 12 passed: only the chained leg1 failed | 12 passed: only the unchecked legGates at
8a69de7Each gate was run separately. Exit codes were written to a file before any pipe.
pnpm exec vitest run --maxWorkers=2 packages/components/src/renderers/form/ packages/i18n/→ exit 0,Test Files 137 passed (137),Tests 1634 passed | 10 skipped (1644).pnpm turbo run type-check --filter @object-ui/components --filter @object-ui/i18n --concurrency=2→ exit 0,Tasks: 10 successful, 10 total. The componentstsconfig.test.jsoncompiles this pin: an earlier implicit-any in it failed this gate and was fixed in22b1755.pnpm exec eslinton the 12 changed.ts/.tsxfiles → exit 0,0 errors. No warning falls on a changed line, and the pin has none.pnpm check:i18n-keys,check:i18n-drift(0envalues changed, 1 key added),check:i18n-dead-keys,check:control-bytes,check:test-path-roots,check:vi-mock-specifiers,check:vi-mock-inherit,check:vi-mock-override-shape,check:new-line-citations(0 new citations),check:changeset-claims,check:pending-changeset-literals, andnode scripts/check-changeset-presence.mjs→ each exit 0.node scripts/check-governed-queue-guard.mjs --testover the 13 changed paths →NOT GOVERNED.check-changeset-claimslisted four pending changesets that nameen.tsorform.tsx(6661, 5594, 5131, 5735). I read each paragraph. None of them says anything this diff moves.check:eager-closure,check:eager-locale-catalogues). They need a full console build, which CI's Bundle Analysis runs. The addition is one short value per pack, so the eagerencatalogue grows by one string.origin/mainwas merged at57a26d0(merge basea50600166).origin/mainhas moved since, to1daf477, without touching any file in this change.Acceptance notes
1c62b68).content/docs/plugins/plugin-form.mdxnow says that when the clear empties a field that held a value, the form raises one notice naming the cleared fields by their labels; that an already-empty field (an unchecked two-state control counts as empty) and the first render are not named; and that a later submit refusal replaces the notice. The seat widened this claim's surface by that one passage, as AGENTS.md Add automated testing infrastructure and CI/CD workflows #2 requires.defaultValuesreset. When a form shows record A with a field visible and then receives record B, where that field is hidden and populated, the swap reads as a VISIBLE to HIDDEN transition. Probe on BASEform.tsx: payloadcrm_contactwasnulland no notice was raised. Since this PR, that path raises the notice naming the column, so it is no longer silent, but the value is still cleared. The effect's own comment says "opening a record never nulls a column the user has not seen". This is reported for the seat to decide whether to file it. The probe was renderer-level, a rerender with newdefaultValuesandpreviousValues; I did not drive it in the console.Generated by Claude Code