Repository navigation
fix(plugin-grid): a list column's inline locale-map label heads the column (objectui#12358) - #12377
Conversation
…jectui#12358) resolveColumnLabel kept only a plain-string label, so a ListColumnSchema label written as an inline locale map (the spec's I18nLabel) was dropped and the header fell back to the field label. The map now goes through pickLocalized against the UI language; a plain string passes through. Claude-Session: https://claude.ai/code/session_01XVp19E1MYUTFM3dnkwz8gB Co-authored-by: Claude <noreply@anthropic.com>
|
No CI run exists on this PR's head The PR was opened at 15:00:53Z. objectui ran no workflow at all between 14:56Z and 15:24Z, scheduled runs included, and this PR's
Plan: once Generated by Claude Code |
Claude-Session: https://claude.ai/code/session_01XVp19E1MYUTFM3dnkwz8gB 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
|
|
Generated by Claude Code |
Fixes #12358
Clause-②: no
What
ListColumnSchema.labelis the spec'sI18nLabel: a plain string or an inline locale map ({ en: 'MAPEN Est', 'zh-CN': 'MAPZH 预计' }). The spec documents the map as resolved by the renderer. In plugin-grid,resolveColumnLabelkept only a plain string and returnedundefinedfor a map. The header then fell back to the field label in every locale.resolveColumnLabelnow takes the viewer's UI language. It passes a plain string through unchanged and resolves a map throughpickLocalizedfrom@object-ui/i18n. That is the same resolver the navigation and Studio label-map fixes use, so there is no second locale-pick implementation. The fallback when the viewer's locale is absent ispickLocalized's own rule: exact tag, base language, a regional sibling,default,en, then the first entry. A map with no usable entry still returnsundefined, so the existing field-label fallback applies as before.The locale source is
uiLanguage, which isuseObjectTranslation().languagethrough the grid'suseGridTranslation. That is the text-language channel thepickLocalizedcall sites across the plugins use.generateColumnsnow listsuiLanguageas a dependency.Readers checked (mechanism assumption A1)
resolveColumnLabelinObjectGrid.tsxis the only place in plugin-grid where a column'slabelis read. Its call site ingenerateColumnsis the one changed.headerproduced there, so this fix covers them too: the column header, the client CSV export header row (generateColumns().map(c => c.header)), the inline-edit conflict dialog's field label (columnHeaderOf), the summary footer (col.header), and the cell face'sfieldMeta.label.labelreads in plugin-grid are object field labels.FieldSchema.labelis az.string()in the spec, so those reads are a different key and are out of scope. The column picker and settings panel are not in plugin-grid.Tests
packages/plugin-grid/src/__tests__/ObjectGrid.columnLabelMap-12358.test.tsxmounts the grid under a realI18nProviderwhose bundle translates every field. A header that fell back to the field label would therefore show the bundle's text and fail.enshows the map'senentry and not the field label.zhshows thezh-CNentry, not theenentry and not the field label. The map listsenfirst, so falling back toenor to the first entry would fail this case.fr, which the map does not carry, showspickLocalized's fallback, theenentry.labelrenders unchanged in bothenandzh.Ablation (one-off; the fix was committed first):
ablation-replace.mjsswappedreturn pickLocalized(label, language) || undefined;forreturn undefined;, which is the old behaviour.Tests 3 failed | 2 passed (5)).git diff HEADis empty.Gates and test runs on head
bacf601:pnpm --filter '@object-ui/plugin-grid^...' build) andtype-check(tsc --noEmitplus the test tsconfig): both exit 0.authoredColumnLabel-12110file and thecellFaceLabel-11689file): 14 of 14 passed.pnpm exec vitest run packages/plugin-grid/):Test Files 213 passed (213),Tests 1929 passed (1929).eslintrun as the package'slintscript runs it, 0 errors. All warnings are on lines outside this diff.check-changeset-fixedandcheck-changeset-presence: all exit 0.check:spec-floorsexits 1 on main for an unrelated reason: "The scan collapsed: 0 package(s) declare @objectstack/spec". This PR does not fix it.Acceptance notes
I18nLabelreads inObjectGrid.tsxresolve againstdisplayLocale(useDisplayLocale: tenant regional locale first, then UI language), not the UI language. These are the view label in the export filename, the caption, the detail label, the description and the empty state. With a tenant regional locale such asen-USand azhUI, those would pick theenentry while this column header pickszh-CN. This is a read-only inference and was not reproduced.Changeset
.changeset/12358-grid-column-label-map.md:@object-ui/plugin-gridpatch.Implemented by session
https://claude.ai/code/session_01XVp19E1MYUTFM3dnkwz8gB.Generated by Claude Code