Repository navigation
Commit eb1f85d
fix(plugin-detail): the compact related card labels its rows from the list columns when they leave the name out (#35497)
Fixes #35263
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户看到的变化:记录页右侧的紧凑关联卡片,如果关系声明了要显示的列且这些列不含子记录名称,每行改用其中第一个可读的查找列(例如所属商机)来命名,不再每行都重复当前页面记录的名字。
-
为什么改:产品页上的商机明细行名称是产品标题的副本,卡片三行都显示同一个产品名,看不出是哪几笔交易;作者已声明了能区分各行的列,只有紧凑卡片没用。
-
改错的后果与回滚:最坏情况是某些卡片的行名从记录标题变成一个查找值;未声明列、列中含名称、无可读查找列或使用标题模板的卡片保持原样;只动一个渲染组件,直接回滚即可。
- 需要你做的:无,席位落地。
## What changes
The compact related card (record page, right column) labelled every row
by the child's record title. A child whose name field is a stored copy
of the parent's title (an opportunity line named by its product's title,
seen from the product page) therefore read the page's own name on every
row, even though the relationship declared the columns that tell the
rows apart.
`compactNameField` in `ui/packages/plugin-detail/src/RelatedList.tsx`
keeps the objectstack#27524 Target 11 rule unchanged (child's name field
IS the key back to this record: first authored column, then declared
field, that is not the key). The guard that returned `undefined` for
every other child, `resolveNameField(objectSchema) !== referenceField`,
now opens a second, narrower path (route N of the dispatch):
- the list declares authored columns, and none of them is the child's
name field (`resolveNameField`), and
- the title is not a template (`titleFormat` with no declared name keeps
the template title),
- then the row is labelled from the first AUTHORED column that passes
the existing candidate test (not the key back, not redacted, not a
platform column, declared on the child, readable by the principal) AND
is a reference-bearing field (`isExpandableFieldType`: lookup /
master_detail / tree / user). Declared-but-unauthored fields are not
read on this path.
- Otherwise `undefined`: the row keeps the record title, as before.
objectstack#27056 Target 2 holds: `compactSelect` already projects
`compactNameField` in place of the name, so the card asks for `id` plus
the label column (and its `$expand` root) and nothing more. Optional
secondary text from the next authored column is out of scope.
## Tests
New top-level `describe` in the shared harness
`RelatedPanel.header-27524.test.tsx` (six cases):
- A1: columns `[quantity, opportunity]`, name `product_title` (a copy of
the product title) labels the rows `Acme renewal` / `Globex pilot`; A2:
the request is `$select: ['id', 'opportunity']`, `$expand:
['opportunity']`.
- Controls: columns include the name (title kept); no authored columns
(title kept); no lookup among the columns (title kept); template title
(kept); the lookup unreadable under field-level security (title kept,
the value is not drawn and not in `$select`).
- The three existing Target 11 cases stay green unchanged.
<details><summary>Red on main's RelatedList.tsx (tree-only restore from
the merge base 609b675, then restored from HEAD and proven by blob
hash)</summary>
```text
× columns that leave the name out label the row from their first lookup, and the card asks for exactly that
AssertionError: expected [ 'Widget', 'Widget' ] to deeply equal [ 'Acme renewal', 'Globex pilot' ]
Test Files 1 failed (1)
Tests 1 failed | 14 passed (15)
os-verify-lock: VERDICT command-exit 1
```
</details>
<details><summary>Green at 4bba85e</summary>
```text
RelatedPanel.header-27524.test.tsx: Test Files 1 passed (1) · Tests 15 passed (15) · VERDICT command-exit 0
pnpm --filter @object-ui/plugin-detail test: Test Files 387 passed | 1 skipped (388) · Tests 3517 passed | 18 skipped (3535)
pnpm --filter @object-ui/plugin-detail type-check (tsc --noEmit && tsc -p tsconfig.test.json): exit 0
os-verify-lock: VERDICT command-exit 0
```
</details>
## Acceptance notes
- Metadata-protocol measured as `none`: no key, value or default an
author writes changes; `relatedListColumns` keeps its meaning (the
columns the related list draws) and the compact card now reads it as it
already did for Target 11.
- Follow-up idea, not filed: secondary row text from the next authored
column (the card's Expected mentions it; the dispatch put it out of
scope).
- The reference-type test uses the existing `isExpandableFieldType`
(lookup, master_detail, tree, user), the same set the card's `$expand`
is built from, so a chosen label column is always one the server can
expand.
## Verification
Local gate subset derived by `node scripts/pm/dispatch-gates.mjs
--commands` at 4bba85e: 36 of 38 families exit 0; `pnpm
check:type-check-debt` and `pnpm --dir ui exec vitest run scripts/` are
NOT MEASURED locally (verify-lock queue timeout behind a sibling's long
suite; the second was SIGKILLed on the shared box) and are left to CI.
Full gate farm and dogfood belong to CI.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 895dd43 commit eb1f85d
3 files changed
Lines changed: 140 additions & 10 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 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1401 | 1401 | | |
1402 | 1402 | | |
1403 | 1403 | | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
1404 | 1413 | | |
1405 | 1414 | | |
1406 | 1415 | | |
1407 | | - | |
| 1416 | + | |
1408 | 1417 | | |
1409 | | - | |
| 1418 | + | |
| 1419 | + | |
1410 | 1420 | | |
1411 | 1421 | | |
1412 | 1422 | | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
1413 | 1436 | | |
1414 | 1437 | | |
1415 | 1438 | | |
1416 | 1439 | | |
1417 | 1440 | | |
1418 | | - | |
1419 | | - | |
1420 | | - | |
1421 | | - | |
1422 | | - | |
1423 | | - | |
1424 | | - | |
1425 | | - | |
| 1441 | + | |
1426 | 1442 | | |
1427 | 1443 | | |
1428 | 1444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
225 | 230 | | |
226 | 231 | | |
227 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
0 commit comments