Repository navigation
Commit f7c545a
fix(plugin-tree): the object tree reads its loading and empty text from the bundle (#28957)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNSK5n9VEENdLx47urr6NTn)_
Fixes #28892
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:对象树(`object-tree`,例如 Setup › 业务单元的默认树视图)的加载态和空态不再写死英文,改读语言包的
`common.loading` / `common.noData`。中文界面显示「加载中…」和「暂无数据」;英文空态从 `No
records` 变为 `No data`。
- **为什么改**:中文界面打开业务单元时,加载中和无数据都显示英文,和整页中文不一致。repeater / record-picker 已在
objectui#12910 改读同一对键,树渲染器漏了。
- **风险与回滚**:低。只改两行文案和 4 个测试里的英文字面,没有新键、没有元数据变化。回滚即还原本 PR。
-
**先看**:`ui/packages/plugin-tree/src/ObjectTree.tsx`(`TREE_DEFAULT_TRANSLATIONS`
和两处占位)、`ui/packages/plugin-tree/src/ObjectTree.placeholderI18n.test.tsx`。
- **两分钟验证**:`pnpm --dir ui exec vitest run
packages/plugin-tree/src/ObjectTree.placeholderI18n.test.tsx`,预期 1 个文件、4
个测试全绿。
- **需要你做的**:无,席位落地。
## What changes
- `ObjectTree` draws its loading line with `t('common.loading')` and its
empty line with `t('common.noData')`, through the `useTreeTranslation`
hook it already calls for the overlay heading. Before, both were the
English literals `Loading…` and `No records`.
- The two keys join `TREE_DEFAULT_TRANSLATIONS`, so a provider-less host
still reads English (`Loading…`, `No data`).
- The English empty line changes from `No records` to `No data`, the
`en` pack's value for `common.noData`. That is the same move
objectui#12910 made for the record picker.
- `ui/packages/i18n` is untouched. Both keys already exist in all ten
packs.
## Tests
- **New: `ObjectTree.placeholderI18n.test.tsx`, 4 cases.** Under a zh
provider, a pending read draws 加载中… and an empty result draws 暂无数据, with
no English beside them. Under en, the same states draw `Loading…` and
`No data`.
- **Four existing files read `No data` instead of `No records`:**
`ObjectTree.contractEnvelope-6839`, `ObjectTree.dataArmSpecRow-8348`,
`ObjectTree.expandedDerived-8666` and
`__tests__/objectTreeInputs-11168`. They render without a provider, so
they read the defaults table.
## Acceptance notes
- **Acceptance 1:** done; see What changes.
- **Acceptance 2 (a declared emptyText still wins): holds, because there
is no declared key on the tree path.**
`ComponentPropsMap['object-tree']` (`ObjectTreePropsSchema`) declares no
`emptyText` or `emptyState`, and plugin-tree reads none. This PR takes
no authored text away.
- **The view-level `emptyState` is not drawn for tree views, before or
after this PR.** `ListView` draws `ListEmptyState` from the view's
`emptyState` only for the grid and gallery layouts, and hands a tree
view's empty set to `ObjectTree`. That is a separate gap in
`ListView.tsx`, outside this card's surface. The seat files it.
- **Acceptance 3:** done; see Tests.
- The error line (`Failed to load tree: …`) is still English. It is
outside this card.
## Verification
All readings are at head `636a312d` (base `origin/main` `9a9823d9`),
under `scripts/pm/os-verify-lock.sh`.
<details><summary>plugin-tree · 26 of 26 files · type-check</summary>
- `pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-tree/`:
Test Files 26 passed (26), Tests 172 passed (172). The lock printed
`VERDICT command-exit 0`.
- `pnpm --filter @object-ui/plugin-tree run type-check` (`tsc --noEmit
&& tsc -p tsconfig.test.json`): exit 0.
- The prerequisite build was `turbo run build` for the plugin-tree
dependency closure plus formula, sdui-parser, lint and client: 48 of 48
tasks.
</details>
<details><summary>Ablations · both red, both restored</summary>
Each leg ran through `scripts/ablation-replace.mjs`, which reported the
anchor count 1 to 0 and a blob change, then restored the file to the
HEAD blob with an empty `git diff HEAD`.
- Loading line put back to the literal `Loading…`: `draws the zh loading
line while its read is pending` red, 1 failed and 3 passed.
- Empty line put back to the literal `No records`: `draws the zh empty
line for an empty result` and `draws the en empty line for an empty
result` red, 2 failed and 2 passed.
</details>
<details><summary>Derived gates · 34 of 34</summary>
`node scripts/pm/dispatch-gates.mjs --commands` derived 34 commands from
this branch. All 34 exited 0, including `node
scripts/check-sdui-manifest.mjs` and `pnpm --dir ui exec vitest run
scripts/`. `dispatch-gates --ran` reconciled 34 run, 0 not measured, 0
unrun. On this exact body, `check-changeset-no-major` and
`check-adr-0087-registration` exited 0, `check-partof-closing-keyword`
exited 0, and `check-closing-keyword-parity --body` lists one closing
declaration, for this card alone.
</details>
Diff: 7 files, 154 changed lines.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jThkd3ikeV2qYP7jeF)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 135054e commit f7c545a
7 files changed
Lines changed: 137 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
| 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 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
112 | 118 | | |
113 | 119 | | |
114 | 120 | | |
| |||
1157 | 1163 | | |
1158 | 1164 | | |
1159 | 1165 | | |
1160 | | - | |
1161 | | - | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
1162 | 1169 | | |
1163 | 1170 | | |
1164 | 1171 | | |
| |||
1181 | 1188 | | |
1182 | 1189 | | |
1183 | 1190 | | |
1184 | | - | |
| 1191 | + | |
1185 | 1192 | | |
1186 | 1193 | | |
1187 | 1194 | | |
1188 | 1195 | | |
1189 | 1196 | | |
1190 | 1197 | | |
1191 | 1198 | | |
1192 | | - | |
| 1199 | + | |
1193 | 1200 | | |
1194 | 1201 | | |
1195 | 1202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
| 320 | + | |
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
| 332 | + | |
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
| |||
0 commit comments