This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
fix(components): record_picker label / placeholder resolve the inline locale map their contract admits (#5637) - #5714
Merged
os-zhuang merged 1 commit intoAug 22, 2026
Conversation
…ocale map their contract admits (#5637) The two remaining keys of the trio objectui#5590 fixed one of. Measured on the installed `@objectstack/spec` 17.1.0 pin, all three members of `ElementRecordPickerPropsSchema` resolve to `optional -> union -> string | record` and `safeParse({ object: 'account', <key>: { en, 'zh-CN' } })` succeeds on each. The renderer honoured only the string arm on both, and they failed in two different ways. `placeholder` was handed raw to `SelectValue`, where React refuses a plain object rather than stringifying it, so the whole picker subtree threw `Objects are not valid as a React child (found: object with keys {en, zh-CN})`. `label` went through the file's local `toText`, whose object branch ends `String(o.label ?? o.name ?? o.title ?? o.en ?? '')` — an English pick wearing locale resolution's clothes, which rendered English to a zh-CN viewer, and whose `?? ''` miss met the `{label && …}` render site, so a map omitting `en` deleted the label element with nothing thrown and nothing logged. Both keys now resolve at their own read site through `pickLocalized`. `toText` is unchanged: it is shared with the row values (`toText(row?.[labelField])`), which are record field values, not `I18nLabel`. The two `ComponentMeta` entries widen from `'string'` to `['string', 'object']` in this same change. Fixes #5637 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EuPCi56cnGyykygi3z9w4m
Contributor
✅ 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
|
os-zhuang
marked this pull request as ready for review
August 22, 2026 20:42
os-zhuang
deleted the
claude/issue-5637-record-picker-label-placeholder-i18n
branch
August 22, 2026 20:43
This was referenced Aug 22, 2026
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 free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Part of #5637
Part of, not the closing keyword the dispatch asked for. Thecard's measured defect — all three fixtures — is fixed here, but one clause of
triage's binding ruling is not implemented and could not be, inside this
change's fence. Merging this should therefore not close the card. Flip the first
line if PM rules the remaining clause is a separate card. Details in
the gap below.
What was broken
packages/components/src/renderers/basic/record-picker.tsxhas three props whosecontract is the
I18nLabelunion. #5590 fixed one (emptyText). The other twowere still unresolved, and they failed in two different ways — which is why a
fix that only stops the throw would be half a fix.
Measured on the installed pin,
@objectstack/spec17.1.0 (the card and #5590both say 17.0.0 GA; the pin has moved and the union is unchanged):
Red-first, run against the unfixed tree with the test file added in this PR,
viewer language
zh-CN(verbatim):placeholderTHREW. It was read raw and handed toSelectValue. Reactrefuses a plain object in a child position rather than stringifying it, so the
whole picker subtree failed — identical harm to the one components:
record-picker'semptyTextdrops the inline-locale-map arm the contract admits, and the audit tracking it (#4163) is closed #5590 removed fromemptyText.labelrendered English. It went through this file's localtoText, whoseobject branch ends
String(o.label ?? o.name ?? o.title ?? o.en ?? '').Reaching
o.enunconditionally is an English pick wearing locale resolution'sclothes.
labelDISAPPEARED. With noenentrytoTextreturns'', and therender site is
{label && …}— so a correctly authored map that simply omitsEnglish deleted the label element, with nothing thrown and nothing logged. This
is the one no static check can see: lint and type-check are green over all
three modes both before and after.
The five passing cases in that red run are the controls and the reachability
case; they are what make the six reds mean something.
What changed
Both keys resolve at their own read site through
pickLocalized— the samehelper, and the same shape, #5590 settled for
emptyTextone key over:The placeholder default is applied before resolution, matching
emptyText:an absent key still means "Select a record…", and an authored
''still rendersempty.
labeltakes no default, so absent still resolves to''and the{label && …}site drops it exactly as before.⛔
toTextis unchanged. It is shared with the row values(
toText(row?.[labelField])), which are record field values, notI18nLabel— teaching it locale resolution would change a second, unrelated callsite. That is the card's own analysis, adopted by triage as the fence, and
verified rather than assumed: the sharing is real, and the diff on this file
touches no line of that function's body.
The two
ComponentMetaentries, which held a single'string'arm preciselybecause the renderer dropped the other one, now declare
['string', 'object']—in this same change and not before, which is the order
ComponentInput.typeprescribes in
@object-ui/typesand the orderemptyTextset. Both descriptionswere rewritten from what the renderer now does, including the two things an
author cannot read off the spec: that "Loading…" / "Failed to load" replace
placeholderwhile the picker is busy, and thatlabelis omitted entirely whenit resolves empty.
The one ruling clause this change does not carry
Triage ruled that
labeltakes the sibling pairing —pickLocalized+translateLabel, matchingcontainers.tsx:569/:831. Only thepickLocalizedhalf is here.translateLabeland itsKNOWN_LABEL_DICTare module-private topackages/components/src/renderers/layout/containers.tsx, which this change'sfence marks hard out-of-scope. Reaching them needs one of:
containers.tsxand import it here — an edit to afenced file, plus a new
basic/ → layout/static import between rendererfamilies, in a repo that weighs the eager import closure with a byte budget
(
scripts/check-eager-closure-budget.mjs); ortranslateLabel+ the dictionary into a shared module — a larger changeacross more out-of-fence files.
Neither is mechanical, so this PR stops at the fence rather than crossing it. A
plain-English string
labelis rendered verbatim in every language here, exactlyas before this change — no regression, just the pairing not yet applied.
Worth weighing when that call is made:
translateLabelis a hardcodedEnglish→Chinese dictionary of well-known tab tokens (
Details,Related,Notes, …), and its two live call sites translate labels thatbuildDefaultTabsgenerated. A record picker's
labelis author-supplied, so the pairing wouldmean the platform silently rewrites an author's literal string. That is an
observation for the decision, not a re-litigation of the ruling.
Verification
Every command below was run at
907ec3e64, the tree of this PR's only commit.record-picker-empty-text-i18n,page-variables,inline-locale-label-read-sites)Test Files 4 passed (4)·Tests 38 passed (38)vitest run packages/componentsTest Files 182 passed (182)·Tests 1638 passed (1638)pnpm --filter @object-ui/components type-checktsc --noEmit && tsc -p tsconfig.test.json, exit 0eslint .inpackages/components✖ 909 problems (0 errors, 909 warnings)over 396 filesTest Files 4 passed (4)·Tests 100 passed (100)pnpm check:control-bytes✅ check-control-bytes: OK (scanned 4767 tracked text file(s); skipped 85 binary).pnpm check:i18n-keysEvery in-scope call-site key resolves against the en pack (2924 keys) …pnpm check:i18n-driftNo en value changed in this range.pnpm check:i18n-dead-keyspnpm check:doc-types✅ Every documented component type is registered.pnpm check:spec-symbols✅ spec symbol derivation: 1294 files scanned …pnpm changeset:check✅ No changeset declares a 'major' bump.The declaration widening needed no out-of-fence edit — unlike #5590, which had
to flip an
apps/consolespecimen. Those four console parity files were run andare green as-is: none of them pins
record_picker.label/.placeholderto asingle arm.
Declared narrowing.
pnpm lintisturbo run lintover 42 packages with alint script; this run covered
@object-ui/componentsonly. The narrowing is ameasurement, not a skip: the population comes from that package's own
eslint .(396 files, its entire file set, not a diff-derived subset);
eslint.config.jsdeclares no
project/projectService, so no type information crosses packageboundaries; and no rule in
eslint-rules/reads a file other than the one it islinting. A change confined to
packages/componentstherefore cannot move averdict in another package's lint run. CI runs the full farm regardless.
Test mechanism
packages/components/src/renderers/basic/__tests__/record-picker-label-placeholder-i18n.test.tsxasserts on rendered output, because nothing static can see this defect. The
registered renderer is invoked directly through
ComponentRegistry.get(thecomponent the registry really renders) inside an
I18nProviderpinned to alanguage, and the three modes are read off the DOM:
resolved string;
container.querySelector('label')?.textContent,asserted for
zh-CNandenon the same map, since an.enpick passesthe English half alone;
expect(labelEl(container)).not.toBeNull()before its text, so a fix that resolved the string but left the element gone
still fails, paired with a control asserting the element stays absent when
labelis absent.The file lives under
renderers/basic/__tests__/(a new directory, matching theexisting
renderers/action|complex|form/__tests__/) because that is the testsurface this change's fence names; #5590 put its sibling file in
packages/components/src/__tests__/. Both are collected by thedomproject'spackages/**/*.test.tsxglob.Generated by Claude Code