Repository navigation
Commit 8b0fbb8
fix(app-shell,fields,plugin-form,plugin-gantt,plugin-grid,components,console): record pages, forms, drawers and preview cards draw a served object label as served (#30475)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgKTazKuWjb7e43MEv6kUCBs)_
domain:ui#3 · os-bill · session_01Utp6CbPN5UYMnBaNJPJWfG
## 维护者速读
-
改了什么:记录页(标题、面包屑、相关列表标题、删除与无权限提示)、记录表单页与新建/编辑弹窗、记录抽屉、预览卡、悬停卡、记录指针单元格、对象引用单元格、只读提示、甘特名称列、页头记录栏、表单视图标题、AI
停靠芯片、动态行与报表索引,统一改为直接显示服务端下发的对象名;只有服务端没下发名称时才查前端翻译目录。
- 为什么改:客户在 `.custom`
覆盖里给已安装对象改名后,列表与页头(上一张卡已修)显示新名,但点进记录、表单、抽屉、预览卡仍是基础包的旧译名,同一个东西出现两个名字。
-
风险与回滚:未改名的对象显示不变(服务端对它下发的就是目录译文);英文不变。风险在于某处对象定义不是按会话语言读来的,那里会显示浏览器语言的名字,已逐处核过(唯一一处裸
fetch 的已打包动作表保持原样)。回滚即 revert 本 PR。
- 先看:`ui/packages/app-shell/src/hooks/servedObjectLabel.ts`(新增单数
`servedObjectLabel`、复数 helper 加 `fallback` 参数,从 useNavTargetLabel
拆出)、`ui/packages/app-shell/src/views/RecordDetailView.tsx`(11
处)、`ui/packages/app-shell/src/console/AppContent.tsx`(弹窗标题与保存提示)。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/hooks/__tests__/servedObjectLabel-30390.test.ts
packages/app-shell/src/views/RecordFormPage.listLinkPlural-11733.test.tsx
packages/app-shell/src/views/record-preview/RecordPreviewCard.test.tsx`,预期全绿,其中
objectstack#30390 分组断言改名后的对象名胜过目录旧译名。
- 需要你做的:无,席位落地。
Fixes #30390
Clause-②: no
Metadata-protocol: none
## What changes
Route 1 of the card (per site), ruled by the seat on the Claim: every
Console surface that names a served object draws the served label as
given, and asks the client catalog (`useObjectLabel`) only when no label
is served. The rule is the one PR #30388 applied to the list and header
surfaces.
- `app-shell`: a singular sibling `servedObjectLabel` next to
`servedObjectPluralLabel` in the private `hooks/servedObjectLabel.ts`
(re-exported by `hooks/useNavTargetLabel.ts` for its existing
importers), and an optional `fallback` argument on both (client text no
server translated, such as the object's name, handed to the catalog
lookup as its own last resort, exactly as the sites passed it before).
Neither is exported from the package entry, so `Clause-②: no`. Sites:
`AppContent` (dialog title ×2, save toast, way-back label),
`ActivityObjectLabel`, `ConsoleLayout` (dock chip), `ObjectDataPage`
(record drawer title), `ObjectView` (delete confirmation, cascade
labels, import wizard), `RecordDetailView` (related-list titles ×2,
phone back and crumb plurals ×2, access-denied and delete copy ×2,
cascade labels, record trail ×2, page title ×2), `RecordFormPage` (title
and list link), `appReportIndex` (plural and singular),
`RecordPreviewCard`, `recordDrawerStack` (singular and plural),
`WidgetRefCellFaces` (object-ref cell; its label comes from the metadata
store's object list).
- Outside `app-shell`, each package applies the same rule inline with
its own served text: `fields` `RecordHoverCard`, `plugin-form`
`ObjectFormContainer` (save toast) and `ClosedAffordanceNotice`,
`plugin-gantt` name column, `plugin-grid` `RecordPointerCell`,
`components` page-header record chrome, and the Console `FormPage`
form-view heading. The last two are the same-class sites the seat added
to the surface.
- One root changeset, `patch` for the seven packages.
## Tests
- New pins (an objectstack#30390 describe each):
`hooks/__tests__/servedObjectLabel-30390.test.ts` (helper rule, inline
locale map, fallback order);
`RecordFormPage.listLinkPlural-11733.test.tsx` (title, toast and list
link of a renamed object);
`RecordDetailView.relatedListTitlePlural-11733.test.tsx` (both
related-list producers); `record-preview/RecordPreviewCard.test.tsx`
(card heading);
`plugin-form/src/closedAffordanceNotice.i18n-11000.test.tsx` (notice
naming). Each renamed case has a no-label control that the catalog still
answers.
- Reverse verification on `54a922c2`: with the pre-change source
restored (tree only) the 9 renamed-object cases go RED and every control
stays GREEN; restored from `HEAD`, `git diff HEAD` empty.
- Consumer sweep on `54a922c2` (every test file named for, or importing,
a changed module, plus every zh-CN fixture file that serves objects; 615
files): 595 passed, 1 skipped, 19 `RecordDetailView.*` files failed to
load because the record page newly reached the metadata provider through
`useNavTargetLabel`'s imports. The helpers moved to
`hooks/servedObjectLabel.ts`, a module with no provider imports
(`useNavTargetLabel` re-exports them); the 19 plus 9 pin and importer
files re-run: `Test Files 28 passed (28)`, `Tests 237 passed (237)`.
- Fixtures that served English in a zh-CN session were corrected to
serve the zh-CN answer the server would serve, assertions unchanged:
`RecordDetailView.recordReadFailure-11902`,
`AppContent.createLandingOriginPlural-11733`,
`AppContent.recordSaveToastNamesRecord-26172`,
`InboxPopover.activityObjectLabel-12212`,
`HomeActivity.objectLabel-12238` (the last two test names now say where
the label comes from), and the first case of
`closedAffordanceNotice.i18n-11000`.
## Acceptance notes
- Not changed, on purpose: `useNavTargetLabel`'s draft-label rung (a
pending draft's label is client text no server translated);
`objectViewPageHeader` (already receives the served plural helper);
`plugin-detail` `record-reference-rail` (two sites) and
`record-related-list` (no definition in hand, only a humanized name:
reported to the seat as out of scope); `PackagedActionsSection` (its
object list is read by a bare `fetch` without the session's
`Accept-Language`, so its served label is in the browser's language, not
the session's; drawing it as given would show English to a zh-CN user
with an English browser).
## Verification
Gate logs, sweep counts and the reverse leg are in the os-dev report
comment on #30390.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Utp6CZgb7dMvMK3Biysr7P
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CZgb7dMvMK3Biysr7P)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 70c3b1c commit 8b0fbb8
31 files changed
Lines changed: 486 additions & 177 deletions
File tree
- .changeset
- ui
- apps/console/src/components
- packages
- app-shell/src
- console
- __tests__
- home/__tests__
- hooks
- __tests__
- layout
- __tests__
- views
- record-preview
- widget-ref-cells
- components/src/renderers/layout
- fields/src
- plugin-form/src
- plugin-gantt/src
- plugin-grid/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3497 | 3497 | | |
3498 | 3498 | | |
3499 | 3499 | | |
3500 | | - | |
3501 | | - | |
| 3500 | + | |
| 3501 | + | |
| 3502 | + | |
| 3503 | + | |
3502 | 3504 | | |
3503 | 3505 | | |
3504 | | - | |
3505 | | - | |
3506 | | - | |
3507 | | - | |
| 3506 | + | |
| 3507 | + | |
3508 | 3508 | | |
3509 | 3509 | | |
3510 | 3510 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
1006 | 1007 | | |
1007 | 1008 | | |
1008 | 1009 | | |
1009 | | - | |
| 1010 | + | |
1010 | 1011 | | |
1011 | 1012 | | |
1012 | 1013 | | |
1013 | | - | |
| 1014 | + | |
1014 | 1015 | | |
1015 | 1016 | | |
1016 | 1017 | | |
| |||
1102 | 1103 | | |
1103 | 1104 | | |
1104 | 1105 | | |
1105 | | - | |
| 1106 | + | |
1106 | 1107 | | |
1107 | 1108 | | |
1108 | 1109 | | |
1109 | 1110 | | |
1110 | 1111 | | |
1111 | 1112 | | |
1112 | 1113 | | |
1113 | | - | |
| 1114 | + | |
1114 | 1115 | | |
1115 | 1116 | | |
1116 | 1117 | | |
| |||
1746 | 1747 | | |
1747 | 1748 | | |
1748 | 1749 | | |
1749 | | - | |
1750 | | - | |
| 1750 | + | |
| 1751 | + | |
1751 | 1752 | | |
1752 | 1753 | | |
1753 | 1754 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
115 | 125 | | |
116 | 126 | | |
117 | 127 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
121 | 131 | | |
122 | | - | |
| 132 | + | |
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
127 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
128 | 140 | | |
129 | 141 | | |
130 | | - | |
| 142 | + | |
131 | 143 | | |
132 | 144 | | |
133 | 145 | | |
| |||
155 | 167 | | |
156 | 168 | | |
157 | 169 | | |
| 170 | + | |
158 | 171 | | |
159 | 172 | | |
160 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | | - | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
109 | 111 | | |
110 | | - | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
115 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
118 | | - | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
164 | 168 | | |
165 | 169 | | |
166 | 170 | | |
| 171 | + | |
167 | 172 | | |
168 | 173 | | |
169 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
0 commit comments