Repository navigation
Commit 5315599
fix(ui): the related tab's create-only add entry reads New, not Add (#37293)
Fixes #37251
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:记录页上主从子对象页签(如客户 →
合同)里那个只能新建的按钮,从「添加」改为「新建」;会弹出选择已有记录的页签仍叫「添加」。
- 为什么做:主从子对象页签的按钮早已直接打开新建表单,却还叫「添加」,用户以为能关联已有记录(客户 CRM 产品负责人报告的问题)。
- 出错会怎样:只影响按钮文字,不影响数据;改坏了直接撤回即可。
- 要你做什么:无。
## What changes
`ui/packages/plugin-detail/src/RelatedList.tsx`, `addEntry`: the branch
with no picker (a `master_detail` child with no catalog, so
`derivedAddOf` answers nothing and the entry calls `onNew`) is now
labelled `t('detail.new')` (New / 新建) instead of `t('detail.add')` (Add
/ 添加). The picker branch is unchanged: the authored `add.label` wins,
else `detail.add`. The `addFallbackLabel` local is gone, since only the
picker branch reads `detail.add` now.
`detail.new` already exists in the `en` pack (`New`), `zh-Hans` (`新建`)
and `DETAIL_DEFAULT_TRANSLATIONS` (`New`), so no locale key is added.
Changeset: `@object-ui/plugin-detail` patch.
## Tests
New top-level `describe` in the existing addEntry harness,
`RelatedList.enlargedToolbar-27524.test.tsx` (`renderList` gains an
optional `language` that wraps the tree in `I18nProvider`):
- en and zh-CN: a `master_detail` child with no catalog reads `New` /
`新建`, clicking it calls `onNew` once, and no picker opens.
- control, en and zh-CN: a `lookup` child (entry opens a picker) reads
`Add` / `添加` and opens the picker.
Ablation (one-off, not kept): with the no-picker label put back to
`detail.add` via `scripts/ablation-replace.mjs`, the two New pins failed
and the two Add controls passed (`Tests 2 failed | 2 passed | 21
skipped`). The file was then restored, and the blob matched HEAD
(`e1f2ad715d08`, `git diff HEAD` empty).
## Acceptance notes
- "An explicit `add.label` still wins" is read as the picker branch,
where it applies today. The no-picker branch never read `add.label`
before, and still does not: an authored `add` label names the
pick-existing action, and putting it on a create-only entry would bring
back the same mislabel.
- The card face's (non-enlarged) header already used `detail.new` for
its New button, so after this change both faces name the create-only
action the same way.
- Serial constraints: this change stays clear of #37246 (imports and
`derivedAddOf`) and #37220 (the count badge). `overlap-check` merges
cleanly against origin/main, #37283, #37220 and #37215.
## Verification
Two-minute check: in `ui/`, run `pnpm exec vitest run
packages/plugin-detail/src/__tests__/RelatedList.enlargedToolbar-27524.test.tsx
-t 37251`. Expected result: 4 passed.
Files to read first:
1. `ui/packages/plugin-detail/src/RelatedList.tsx`, the `addEntry` hunk
(the only runtime change).
2. The new `describe` at the end of
`RelatedList.enlargedToolbar-27524.test.tsx`.
All readings below were taken at head 9d9bce7.
<details><summary>Package tests and type-check</summary>
- `pnpm --filter @object-ui/plugin-detail type-check && pnpm --filter
@object-ui/plugin-detail test` under the verify lock: `VERDICT
command-exit 0`, `Test Files 418 passed | 1 skipped (419)`, `Tests 3953
passed | 18 skipped (3971)`.
- Harness plus sibling `RelatedList.derivedAddScope-36707.test.tsx`:
`Test Files 2 passed (2)`, `Tests 34 passed (34)`.
</details>
<details><summary>Derived gates</summary>
- `node scripts/pm/dispatch-gates.mjs --commands` derived 38 commands.
All 38 ran and every one exited 0. `check:changeset-fixed` also ran
(exit 0).
- `--ran` reconciliation: `38 derived famil(ies) accounted for, 38 run,
0 NOT-MEASURED (a DERIVED zero, all 38 recorded an exit code)`.
- CI owns the full farm, including `test:repo` and the UI lanes.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 08bf7d2 commit 5315599
3 files changed
Lines changed: 65 additions & 5 deletions
File tree
- .changeset
- ui/packages/plugin-detail/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2827 | 2827 | | |
2828 | 2828 | | |
2829 | 2829 | | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
2830 | 2835 | | |
2831 | 2836 | | |
2832 | | - | |
2833 | 2837 | | |
2834 | 2838 | | |
2835 | | - | |
| 2839 | + | |
2836 | 2840 | | |
2837 | 2841 | | |
2838 | 2842 | | |
2839 | 2843 | | |
2840 | 2844 | | |
2841 | | - | |
| 2845 | + | |
2842 | 2846 | | |
2843 | 2847 | | |
2844 | 2848 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| 118 | + | |
117 | 119 | | |
118 | 120 | | |
| 121 | + | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
124 | 128 | | |
125 | | - | |
| 129 | + | |
126 | 130 | | |
127 | 131 | | |
128 | 132 | | |
| |||
141 | 145 | | |
142 | 146 | | |
143 | 147 | | |
144 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
145 | 154 | | |
146 | 155 | | |
147 | 156 | | |
| |||
507 | 516 | | |
508 | 517 | | |
509 | 518 | | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
0 commit comments