Repository navigation
fix(studio): a seeded record page heads its More details section with the translated heading - #33575
Conversation
… the translated heading Studio's full-page seed and Convert to full page wrote the "More details" section's label as the plain English string, so a saved page read English for every viewer. They now write the inline locale map of detail.sectionMoreDetails from every shipped catalogue, the I18nLabel form record:details resolves per viewer; the section keeps its details name, so the object's own _sections.details.label still wins. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5p26Duousy4rdtkRMB
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD 席位核对Verdict: ACCEPT · head
|
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Landing · head
State: ready + auto-merge. |
Requested by Leehom · project thread
domain:ui#1 · os-project-manager · session_01FEkQ5p26Duousy4rdtkRMB
Fixes #33471
Clause-②: no
Metadata-protocol: none
Seat
domain:ui#1· card threadsession_01FEkQ5p26Duousy4rdtkRMB· claim 6886592905维护者速读
detail.sectionMoreDetails),保存后的页面按查看者的语言显示。对象自己语言包里的_sections.details.label仍然优先。ui/packages/app-shell/src/views/recordDetailSections.ts的loadPersistedSectionLabels;metadata-admin/previews/PagePreview.tsx的convertToFull;metadata-admin/anchors.ts的 record 页createSeed。pnpm --dir ui exec vitest run packages/app-shell/src/views/recordDetailSections.studioMoreDetailsHeading-33471.test.tsx,预期 5 条全绿(中文显示「更多详情」,英文显示 "More details",对象语言包的标题优先)。What changes
Measured first, on
origin/main(8e63ed87). Studio's create seed (metadata-admin/anchors.ts, record pagekind: 'full') andPagePreview.tsxconvertToFullpassedMORE_DETAILS_DEFAULT_LABELas thedetailssection's label, so the saved section was{ name: 'details', label: 'More details', … }. The red-first run below draws that saved seed through the realRecordDetailsRendererunderzh-CN: 「更多详情」 is not on the page (the English text is), while en and an object bundle carrying_sections.details.labelread correctly. It reproduces.How
record:detailsresolves the heading (the measurement the order asked for). Inplugin-detailrecord-details.tsx, a section'slabelis first resolved for the viewer withpickLocalized(s.label, language), and when the section has aname, that text is passed as the FALLBACK tosectionLabel(objectName, s.name, rawTitle ?? s.name), which answersobjects.OBJECT._sections.NAME.labelwhen the bundle has it (useObjectLabelsectionLabel→resolve(objectSuffixes(…), fallback)). So an inline locale map never shadows the per-object override: the override wins over the map exactly as it wins over a string. Leavinglabelunset would not help either: the fallback then becomes the literal section namedetails. ⇒ the form #33470 chose for the ungrouped bucket fits here too, and this PR uses it. The CONTROL pin below draws the override winning over the map.The change.
recordDetailSections.ts:loadPersistedUngroupedHeadingbecomesloadPersistedSectionLabels(objectDef), which answers both headings the derivation writes itself, each as the inline locale map of its catalogue key over every catalogue@object-ui/i18nships (BUILT_IN_LANGUAGE_CODES+loadBuiltInLocale):moreDetailsfromdetail.sectionMoreDetails,ungroupedfromcommon.ungroupedSection(unchanged). It loads the catalogues only when the page writes one of them (the object'sfieldGroupsapply, or the flat split yields adetailssection), and otherwise answers the English defaults, which no section reads. One catalogue that fails to load rejects the whole call (Promise.all), so no partial map is ever saved (the fix(studio): a seeded grouped record page heads its ungrouped fields with the translated Other heading #33470 rule).RecordDetailSectionLabels.moreDetailswidens fromstringtoSectionHeading(app-shell internal).anchors.ts(create seed) andPagePreview.tsx(convertToFull) passloadPersistedSectionLabels' answer. "Convert to full page" stays disabled until it has loaded for the current object, as before, and stays unavailable if a catalogue fails.RecordDetailView) and the slotted preview still pass the translated text; they are untouched.What an existing page shows. No migration. A page saved before this change keeps
label: 'More details'(a plain string): every viewer reads English, unless the object's bundle carries_sections.details.label, which still wins. An author can change the heading in the page designer, or re-create the page.Why
The running record page translates the "More details" heading for every viewer; a page Studio seeded saved it as English, so the same page read differently once saved. #33470 settled the persisted form for the sibling "Other" heading; this applies it to the other heading the seed writes itself.
Tests
recordDetailSections.studioMoreDetailsHeading-33471.test.tsx(5 tests, the realRecordDetailsRendererunderI18nProvider, as fix(studio): a seeded grouped record page heads its ungrouped fields with the translated Other heading #33470's pins).details.labelas the map of every shipped catalogue'sdetail.sectionMoreDetails(keys =BUILT_IN_LANGUAGE_CODES,en"More details",zh-Hans「更多详情」), never a string; firing control: the split yields[['name','subject'],['notes']].RecordDetailsProps.zh-CN: 「更多详情」, no "More details", above thenotesvalue.en: "More details"._sections.details.label(「补充信息」) wins over the saved map.PagePreview.slottedDefault-27054.test.tsx: "Convert to full page" on a flat object with a textarea writes thedetailssection under the same map, and the converted page passesvalidateMetadataDraft('page', …)and the block props check.recordDetailSections.studioUngroupedHeading-33377.test.tsxCONTROL: a flat object's primary section stays unheaded and only itsdetailssection carries a map; a page that writes neither heading answers the English defaults (it called the removedloadPersistedUngroupedHeading).recordDetailSections.agreement-12442.test.ts: the flat seed equals the runtime split with the persisted headings, anddetails.label.enis "More details".Red-first on origin/main sources (the three source files checked out at 8e63ed8, tests at head): 3 failed | 8 passed (11)
Ablation at head 8ade4c0: the map put back to the English string — 3 failed | 8 passed (11); restored, blob == HEAD
Touched and sibling files at head 8ade4c0
Acceptance notes
@object-ui/app-shellis private; its dist ships in@object-ui/console, so the changeset names both (the fix(studio): a seeded grouped record page heads its ungrouped fields with the translated Other heading #33470 precedent).Clause-②: no: no published API or metadata contract moves; the inline locale map is a formrecord:detailssections[].labelalready declares (I18nLabel).Metadata-protocol: none.Verification
All local readings at head
8ade4c0d(the PR head).pnpm --filter @object-ui/app-shell run type-check(bothtsc --noEmitandtsc -p tsconfig.test.json), afterpnpm --filter '@object-ui/app-shell^...' build: exit 0 (os-verify-lock: VERDICT command-exit 0 · held the lock 145s …).pnpm check:new-line-citations(ui):VERDICT new-cross-file-line-citations: 0 new citation(s), enforcement report-only -> exit 0.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack), each exit code captured before any pipe; reconciliation✓ dispatch-gates --ran: 36 derived famil(ies) accounted for — 36 run, 0 NOT-MEASURED (a DERIVED zero — all 36 recorded an exit code and none of them is 3).36 derived families, all exit 0
Every family CI runs (the full Test UI shards, lint, the artifact roster) is read off this PR's check-runs; nothing there is re-run locally.
Human Minimum
packages/specholds no runtime logic. (Nopackages/specchange.)pnpm lintis CI's run.main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code