Repository navigation
Commit 8061d83
fix(app-shell): record-tabs rename gate reads the served sourceLocale (#37381)
Fixes #36875
Clause-②: no
Metadata-protocol: none
## 维护者速读
用户能看到什么变化:搭建者在设计模式里给记录页签改名时,「能不能改名」改按应用的源语言判断,不再按部署的默认语言判断;默认语言与源语言相同的部署用户无感。
为什么做:接着菜单改名已改用源语言的那项工作,把记录页签改名补齐到同一种判断。
出错会怎样:默认语言与源语言不同的部署上,页签名可能被当成源文字写入或该能改时改不了;本改动只换判断依据,可直接撤回。
要你做什么:无
## What changes
`ui/packages/app-shell/src/views/recordTabsConfigIo.tsx` decided "source
language" with `fetchDefaultLocale()` + `isSameLanguage(language,
defaultLocale)`. It now reads the deployment's languages through the
reader PR #36858 added, `fetchDeploymentLocales()`, and asks
`labelLanguageOf(language, locales).source`, the exact gate the menu
rename uses. That reader takes the served `sourceLocale` and falls back
to the default locale when the server serves none, so the fallback is
the reader's own. No second fetch: the reader is cached per page load
and shared with the menu.
What the editor does with the answer is unchanged: in the source
language a rename opens and writes the stored label; in any other
language the rename button is disabled with the hint "Tab names are
changed in the app's source language".
## Tests
New file
`ui/packages/app-shell/src/views/__tests__/RecordTabsConfig-36875.test.tsx`,
same harness as the #36499 suite, the `GET /i18n/locales` fake now
serving `sourceLocale`:
1. default locale zh-CN, source en, reader in zh-CN: rename disabled
with the source-only hint, Save disabled, nothing written.
2. default locale zh-CN, source en, reader in en: rename opens, Save
writes `relatedLists` `[{ list: 'contact', label: 'Contacts we know' },
'task']` through the draft save, then publish.
3. no `sourceLocale` served: the default locale is the source, as before
(zh-CN reader renames, en reader cannot).
Reverse check (one-off, no file kept): with the fix committed
(`e2288d21`), `recordTabsConfigIo.tsx` was put back to `origin/main` and
the new file run. Cases 1 and 2 turned red (`Tests 2 failed | 1 passed
(3)`), case 3 stayed green as expected (fallback behaviour is
unchanged). Restored with `git checkout HEAD -- PATH`; HEAD blob hash
matched, `git diff HEAD` empty.
## Acceptance notes
- Acceptance item 2 says the test "stores a tab rename as a
translation". The record-tabs editor has no translation write path:
outside the source language its rename is closed by design (#36499,
ruling (4) precedent), it never writes a translation. The test therefore
proves the side the fix controls: a reader in a default locale that is
not the source language cannot write the tab name as the source label,
and a reader in the source language can. Adding a translation write to
record tabs would be a new capability, not this card.
- `fetchDefaultLocale` in `layout/designModeMenuSave.ts` has no caller
after this change (it was the only one). Left in place: that file is the
#36858 reader's and outside this card's file surface.
- The lazy-import comment in `RecordTabsConfig.tsx` (~L95) still says
"the default language"; comment only, outside the file surface.
- No other design-mode rename path gates on the default locale: `git
grep` for `fetchDefaultLocale` / `isSameLanguage(` under `ui/` finds
only the reader itself.
## Verification
Two-minute check: `cd ui && pnpm exec vitest run
packages/app-shell/src/views/__tests__/RecordTabsConfig-36875.test.tsx`
→ 3 passed.
Read first: `ui/packages/app-shell/src/views/recordTabsConfigIo.tsx`
(the whole change is the gate line and the fetch it reads).
<details><summary>Local readings at e2288d2</summary>
- `pnpm --filter '@object-ui/app-shell^...' build` → VERDICT
command-exit 0
- `cd ui && pnpm exec vitest run --maxWorkers=2` the three
RecordTabsConfig suites + `packages/app-shell/src/layout/` → Test Files
167 passed (167), Tests 1467 passed (1467)
- `pnpm --filter @object-ui/app-shell run type-check` → exit 0
- `node scripts/pm/dispatch-gates.mjs --commands`: 38 derived commands,
all exit 0; `--ran` reconciliation: 38 derived, 38 run, 0 NOT-MEASURED,
0 UNRUN (a derived zero). `pnpm --dir ui exec vitest run scripts/` was
OOM-killed on the first unlocked run on the shared box, rerun under the
verify lock with `--maxWorkers=2`: 172 passed, 2 skipped files.
- `node scripts/pm/overlap-check.mjs --branch=HEAD` → VERDICT clean exit
0
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6Ca6EBDpTBZk8v46Jjv)_
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent ecbe854 commit 8061d83
3 files changed
Lines changed: 234 additions & 7 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views
- __tests__
| 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 | |
|---|---|---|---|
| |||
| 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 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | | - | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
30 | | - | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
50 | | - | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
64 | | - | |
65 | | - | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
| 75 | + | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| |||
0 commit comments