Repository navigation
fix(plugin-detail): a highlight chip with no translation is captioned by the field's declared label - #26564
Conversation
…rung (red first) Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup Co-authored-by: Claude <noreply@anthropic.com>
… by the field's declared label The chip caption now climbs the details body's label ladder: the bundle's translation, then the strip entry's label, then the label the object declares (read in the session language), then the field name. Claude-Session: https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup Co-authored-by: Claude <noreply@anthropic.com>
…ghlight-chip-caption
维护者速读改了什么:记录页标题下的高亮条,字段没有翻译条目时,每个小标题不再空白,而是显示对象定义里声明的字段标签(内联多语言标签按当前语言取),没有声明标签时显示字段名;有翻译或视图里写了标签时仍以它们为准。 席位核对seat 2 · 2026-10-27T09:01Z · head
|
Fixes #26417
Clause-②: no
Metadata-protocol: none
维护者速读
HeaderHighlight.tsx的小标题取值一处,有翻译或作者标签的页面渲染不变(测试钉住);回滚即 revert 本 PR。ui/packages/plugin-detail/src/HeaderHighlight.tsx中caption的取值;新测试record-highlights.declaredCaption-26417.test.tsx。pnpm --dir ui exec vitest run packages/plugin-detail/src/renderers/__tests__/record-highlights.declaredCaption-26417.test.tsx,预期 7 个测试全绿。What changes
ui/packages/plugin-detail/src/HeaderHighlight.tsx: the chip caption wasfieldLabel(objectName, field.name, field.label). With no bundle key and no label on the strip entry (every entry the synthesized page handsrecord:highlights, which passes bare names through as{ name }), the fallback wasundefinedand the caption rendered as an empty span.The caption now climbs the details body's ladder, the same rungs in the same order:
fieldLabel, unchanged);pickLocalizedin the session language, so an inline locale map never renders as an object;Rungs 2 and 3 are the details body's
withDeclaredLabel(renderers/record-details.tsx) and rung 4 isDetailSection'sfield.label || field.name.DetailSection.tsxandrecord-details.tsxare not touched.The ladder sits in
HeaderHighlight, not in therecord:highlightsnormaliser, becauseHeaderHighlighthas two callers: therecord:highlightsrenderer andDetailView'sschema.highlightFields. Both already hand it the object definition, so filling the rung once covers both. It is computed on every render, so a definition that arrives after the record replaces the field-name caption with the declared label.record-highlights.tsxgains one comment line that says where a bare name gets its caption.Tests
New:
ui/packages/plugin-detail/src/renderers/__tests__/record-highlights.declaredCaption-26417.test.tsx. Each leg first finds the chip by its value, so an empty caption cannot pass as a strip that drew nothing.所有者/关联客户(the card's case).阶段in zh,Stagein en.DetailViewpath,HeaderHighlightmounted directly): the caption is the field name before the definition arrives and the declared label after.Red, then green
0729de2e(the test alone, before the fix):pnpm exec vitest run packages/plugin-detail/src/renderers/__tests__/record-highlights.declaredCaption-26417.test.tsxfromui/under the verify lock,VERDICT command-exit 1, Tests 7 failed (7). Four legs failed on an empty caption (received''): bare names, the locale map, the field-name fallback and the late definition. The bundle and authored-label legs passed their first assertion (the bundle entry, the authored label) and then failed on the unbundled sibling's empty caption. The agreement leg failed on its harness: with no name field declared, the details body dropsowneras the record title. The fix commit switches that leg tocustomerandstage.542908d2(fix plusorigin/mainmerged), fromui/under the lock:pnpm exec vitest run packages/plugin-detail --maxWorkers=2exit 0, Test Files 310 passed and 1 skipped (311), Tests 2876 passed and 18 skipped (2894).pnpm --filter @object-ui/plugin-detail type-check(tsc --noEmit && tsc -p tsconfig.test.json) exit 0. The new file alone, verbose, Tests 7 passed (7).Gates at
542908d2node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 34 commands. 32 exited 0, includingnode scripts/check-sdui-manifest.mjs(manifest present and intact, 106 components; no registry contract changed, so nothing was regenerated).--ranreconciliation: 34 derived, 33 run, 1 NOT-MEASURED, 0 UNRUN.pnpm check:type-check-debt: exit 3, PREREQUISITE NOT MET. Its closure build queued on the shared verify lock twice and never got a turn. CI'sLint & Repo Gatesis the reading.pnpm --dir ui exec vitest run scripts/: exit 1, but the run was killed with SIGKILL before its summary. Two tests had already timed out at about 18.8 s under box contention:check-hand-rolled-comment-mask.test.ts("exits 0 as a process") andjs-comment-mask-returns-interpolation-9424.test.ts(the type-check:scripts program). Both testui/scripts/, which this diff does not touch. The first one's subject,node ui/scripts/check-hand-rolled-comment-mask.mjs, run directly on this tree, exits 0. CI is the reading.Acceptance notes
DetailView's ownhighlightFieldspath (HeaderHighlightmounted directly) gets the same caption, because the ladder sits inHeaderHighlight. The late-definition leg pins it.DetailSection.tsx,record-details.tsxand the locale packs are untouched. No new i18n key.withDeclaredLabelinrecord-details.tsx(rungs 2 and 3, filled on the entry) andHeaderHighlight(computed at render). The agreement leg pins that both give the same text. Extracting one shared helper would mean editingrecord-details.tsx, which is outside this card's file surface. Carrier: none. Noted here only.Generated by Claude Code