Repository navigation
Commit ab44198
fix(plugin-detail): related list row Delete confirm names the row by its declared nameField (#34890)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBU5y97XtBcJ8qSLSR3B3Djd)_
repo:objectstack#3 · os-support-ai · session_01WGufzgwLiKcfujYUug7sPs
Fixes #34788
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:相关列表(如「商机 → 相关 → 商机产品明细」)的行删除确认框,现在用子对象声明的 `nameField`
显示记录名,不再显示「Record #ID」。
- **为什么改**:列表配置了列且列里没有名称字段时,取数只取列字段,删除确认框拿不到名称,用户确认删除时看不到删的是哪条。
- **风险与回滚**:风险低,只是取数多带一个名称字段;无权读取或被屏蔽的名称字段仍不取。回滚即 revert 本 PR。
- **先看**:`ui/packages/plugin-detail/src/RelatedList.tsx` 的
`selectFields`(新增的 declared name field
一段);`RelatedList.deleteConfirmNamed-13333.test.tsx` 新增的 describe。
- **两分钟验证**:`pnpm --dir ui exec vitest run
packages/plugin-detail/src/__tests__/RelatedList.deleteConfirmNamed-13333.test.tsx`,预期
6 个用例全部通过。
- **需要你做的**:无,席位落地。
## What changes
`RelatedList`'s `$select` projection (`selectFields`) now also asks for
the child object's DECLARED name field (`declaredNameField`:
`nameField`, then its deprecated `displayNameField` alias), so the row
Delete confirm (`detail.deleteRowConfirmation`, resolved by
`getRecordDisplayName`) can name a row whose name column is not shown.
The name field goes through the same gates as the projection's other
non-column members (predicate operands, gallery cover): the child object
declares it or it is a platform column; the viewer may read it (FLS)
when it is declared; the block does not redact it. It is fetched only
and never drawn as a column. A derived title field and a `titleFormat`
template are not requested: neither is a declared pointer. This is the
same arm `ObjectGrid` (`objectGridRowLoad.ts`) and `ListView` already
carry for their bulk confirms. A list with no authored columns still
sends no projection.
## Why
A related list with authored columns projected its fetch to those
columns, `id`, the `$expand` roots, predicate operands and the gallery
cover. The confirm reads the name from the row that fetch returned. When
the declared `nameField` was not a column, the row arrived without it
and the sentence fell to the resolver's `Record #ID` floor.
## Tests
New top-level describe in the delete confirm's existing harness,
`RelatedList.deleteConfirmNamed-13333.test.tsx`. Its data source honours
`$select` the way the data API does: only the requested keys come back.
- `a nameField no column shows is requested, never drawn, and names the
row`: every `$select` contains `full_name`, the fetched row carries it,
the drawn columns stay `['email']`, and the dialog says `Are you sure
you want to delete "Ada Lovelace"?`.
- `a nameField the principal cannot read is not requested, and the
confirm reads the id floor`: FLS denies `full_name`, no `$select`
contains it, and the dialog reads `Record #c1` as before.
- `CONTROL: a shown name column is requested once, as before`: columns
`['full_name','email']` give the projection `{email, full_name, id}`
with no duplicate entry.
Ablation of the fix on commit `33e54b63d3`
(`scripts/ablation-replace.mjs`, anchor `projection.add(declaredName);`
replaced by a no-op marker, auto-restored): the main pin went red
(`Tests 1 failed | 5 passed (6)`). The FLS and CONTROL cases stay green
under the ablation, as expected, because they assert absence and an
unchanged projection. The restore was verified as blob equal to HEAD and
an empty `git diff HEAD`.
## Acceptance notes
- **Live repro, before and after** (CRM example, `objectstack dev` on a
private port, Console Vite dev server from this branch's `ui/` source).
I made a temporary local edit, `relatedListColumns: ['email']` on
`crm_contact.account` (`crm_contact` declares `nameField: 'full_name'`),
and restored it afterwards. Steps: Acme Corp account, Contacts tab, row
menu, Delete.
- Before: the request was `GET
/api/v1/data/crm_contact?top=25&skip=0&select=id,email&filter=["account","=","f0XomXLBbu835454"]`.
Each response row had the keys `id,email`. The dialog said `Are you sure
you want to delete "Record #nbkWdK1xsYpQsMvN"?`.
- After: the request was `...&select=id,email,full_name&...`. Each
response row had the keys `id,email,full_name`. The dialog said `Are you
sure you want to delete "Ada Lovelace"?`. The table still draws only the
Email column.
- The compact related-card face already projects the name
(`compactSelect`), so the record page's side panels were unaffected.
Only the full table face (the tab, as in the reported path) lost the
name.
- Not measured: an object with NO declared `nameField`, whose derived
title field (`deriveTitleField`) is not a column, still reads `Record
#ID` in this confirm. This matches the `ObjectGrid`/`ListView` arms,
which also request only the declared pointer, and an existing pin
requires `$select` to be exactly `['id']` for such an object. Left as
is.
## Verification
<details><summary>Local runs on head 33e54b6</summary>
- `pnpm --dir ui exec vitest run packages/plugin-detail/` (under the
verify lock): `Test Files 384 passed | 1 skipped (385)`, `Tests 3457
passed | 18 skipped (3475)`, lock VERDICT command-exit 0.
- `pnpm --filter @object-ui/plugin-detail run type-check`: exit 0.
`--listFiles` on `tsconfig.test.json` includes the edited test file.
- `node scripts/pm/dispatch-gates.mjs --commands` derived 38 families.
All 38 ran with exit 0. `--ran` reconciliation: `38 derived famil(ies)
accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero)`.
- `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0`
(origin/main d947a93, 0 PR heads).
- `ui` `check:new-line-citations`: 0 new citations. `eslint` on the two
edited files: 0 errors.
- The full lint and test farm runs in CI.
</details>
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(`packages/spec` untouched.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (`eslint` on the edited
files reports 0 errors; the repo-wide run is CI's.)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (Not touched.)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English. (The 维护者速读 block is
the dispatch contract's Chinese summary.)
- [ ] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzgwLiKcfujYUug7sPs -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent f012183 commit ab44198
3 files changed
Lines changed: 140 additions & 1 deletion
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 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1257 | 1257 | | |
1258 | 1258 | | |
1259 | 1259 | | |
1260 | | - | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
1261 | 1263 | | |
1262 | 1264 | | |
1263 | 1265 | | |
| |||
1328 | 1330 | | |
1329 | 1331 | | |
1330 | 1332 | | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
1331 | 1350 | | |
1332 | 1351 | | |
1333 | 1352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
115 | 117 | | |
116 | 118 | | |
117 | 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 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
0 commit comments