Repository navigation
Commit ebb4713
fix(plugin-grid): a phone list card never repeats a formula title in its subtitle (#37079)
Fixes #37010
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:手机上打开工单、线索这类以公式字段作标题的列表时,卡片副标题不再重复标题里的内容,而是显示紧急程度、客户等下一批信息。
- 为什么做:手机列表卡片的标题与副标题重复,用户在一张卡上看不到记录的其他关键信息。
- 出错会怎样:最坏情况是手机卡片副标题少显示或多显示一列,数据与保存都不受影响,可直接撤回本改动。
- 要你做什么:无
## What changes
`buildMobileCardRenderer` in
`ui/packages/plugin-grid/src/ObjectGrid.tsx`: when the object's declared
name field is a `formula`, the card's subtitle skips every shown column
whose field the formula reads, and takes the next shown columns instead.
The reads are the formula's `record.FIELD` references as
`collectPredicateFieldRefs` (`@object-ui/core`) names them, the same
reader this grid's projection already uses for a CEL expression's reads
(`objectGridQueryInputs.ts`); a read through a lookup
(`record.account.name`) names the lookup, so its column is skipped too.
This holds whether or not the formula column itself is shown. A name
field that is not a formula reads nothing, so its card is unchanged.
Status chip and amount line are untouched.
Case list, as filed: title `CASE-00037 - Demo case 29 — critical
problem`, subtitle `紧急 · Polar Cargo` (was `CASE-00037 · Demo case 29 —
critical problem`).
Changeset: `.changeset/37010-phone-card-formula-title-subtitle.md`,
`@object-ui/plugin-grid` patch.
Read first (by risk):
1. `ObjectGrid.tsx`, the `titleReads` block and the `subtitleColumns`
filter in `buildMobileCardRenderer`.
2. `__tests__/phoneCardFormulaTitle-37010.test.tsx`.
Two-minute check: `cd ui/packages/plugin-grid && pnpm exec vitest run
--root ../..
packages/plugin-grid/src/__tests__/phoneCardFormulaTitle-37010.test.tsx`
shows 3 passed.
## Tests
New file
`ui/packages/plugin-grid/src/__tests__/phoneCardFormulaTitle-37010.test.tsx`,
through the real `ObjectGrid` card renderer at 375 px with the object
schema served by the data source:
- formula name field over the two leading columns: subtitle is `紧急 ·
Polar Cargo`;
- the formula column shown as well: the subtitle still skips the
formula's parts;
- CONTROL: a text name field (`subject`) keeps `CASE-00037 · 紧急`.
## Acceptance notes
- Reader choice: the platform's AST member reader for a formula's reads
is `analyzeRelationshipTraversals` (`@objectstack/formula`), which
`planObjectFormulas` in `@object-ui/core` uses. `@object-ui/plugin-grid`
does not depend on `@objectstack/formula`, and adding it (its
`package.json` and `pnpm-lock.yaml`) is outside this card's claimed file
surface. This PR uses `collectPredicateFieldRefs`, already a dependency
of this grid for the same question. The two readers differ only on
spellings a name formula does not use in practice (a `record.FIELD`
inside a string literal, a `data.FIELD` root); either difference can
only skip a column, never draw a wrong value.
- Seat decision on that reader question: option A,
`collectPredicateFieldRefs`, the reader this grid's projection already
uses, with no new dependency.
- Overlap with #36978 (also edits `ObjectGrid.tsx`):
`scripts/pm/overlap-check.mjs` VERDICT clean exit 0, against origin/main
and against #36978.
## Verification
All readings at head `84c9eec38eb`.
<details><summary>New test file</summary>
`phoneCardFormulaTitle-37010.test.tsx`: Test Files 1 passed, Tests 3
passed.
</details>
<details><summary>Ablation (one run)</summary>
`scripts/ablation-replace.mjs` replaced the anchor
`!titleReads.has(c.accessorKey)` with a marker. Anchor count went 1 to
0, blob `5fbd40d54cf4` to `52c21da6b1a0`. Result: 2 failed and 1 passed
(the control). Both failures received `CASE-00037 · Demo case 29 —
critical problem`, which is the filed defect. After restore the blob
equals the HEAD blob (`5fbd40d54cf4`) and `git diff HEAD` is empty. The
first attempt was a no-op that the tool refused (the replacement was a
substring of the anchor), so no test ran then. It was redone with a
distinct marker.
</details>
<details><summary>Package @object-ui/plugin-grid</summary>
`type-check` (`tsc --noEmit && tsc -p tsconfig.test.json`) passed.
vitest: Test Files 311 passed, Tests 2763 passed.
</details>
<details><summary>Derived gates</summary>
`dispatch-gates --commands` derived 39 commands. On the first pass 37
exited 0.
- `pnpm --dir ui exec vitest run scripts/` exited 1. Four tests in three
files hit the 15000 ms timeout while the box was contended, and none of
them touch this diff. Those three files were re-run under the lock:
231/231 passed.
- `pnpm check:type-check-debt` exited 3 (lock queue-timeout, NOT
MEASURED). The re-run under the lock exited 0.
`--ran` reconciliation on the first-pass codes: 39 derived, 38 run, 1
NOT-MEASURED, 0 UNRUN.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ)_
<!-- signed: repo:objectstack#4 · os-justin ·
session_01QSeKYpEsWWE9Y5YtSsDgqZ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 1b3b1b4 commit ebb4713
3 files changed
Lines changed: 182 additions & 3 deletions
File tree
- .changeset
- ui/packages/plugin-grid/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 | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
4452 | 4452 | | |
4453 | 4453 | | |
4454 | 4454 | | |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
| 4458 | + | |
| 4459 | + | |
| 4460 | + | |
| 4461 | + | |
| 4462 | + | |
| 4463 | + | |
| 4464 | + | |
| 4465 | + | |
| 4466 | + | |
| 4467 | + | |
| 4468 | + | |
| 4469 | + | |
4455 | 4470 | | |
4456 | 4471 | | |
4457 | 4472 | | |
| |||
4471 | 4486 | | |
4472 | 4487 | | |
4473 | 4488 | | |
4474 | | - | |
| 4489 | + | |
| 4490 | + | |
4475 | 4491 | | |
4476 | 4492 | | |
4477 | 4493 | | |
| |||
4484 | 4500 | | |
4485 | 4501 | | |
4486 | 4502 | | |
4487 | | - | |
| 4503 | + | |
| 4504 | + | |
| 4505 | + | |
4488 | 4506 | | |
4489 | 4507 | | |
4490 | 4508 | | |
| |||
| 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 | + | |
0 commit comments