Repository navigation
Commit 1900c02
fix(console): a child written through an authored related list refreshes the record page's header (#27106)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8QyKhkPtEoqpCPduABeGG56)_
Fixes #26890
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:记录页在子记录写入后重读父记录时,除了按关系推导出的相关列表,现在也盯住作者自己在页面上列出的相关列表块和侧栏引用卡片里的子对象。
- 为什么改:作者自建的记录页可以列出一个外键写了 `relatedList: false`
的子对象,这时它不在推导集合里,经该列表新建、编辑或删除子记录后,表头的汇总值(如报价总额)要刷新页面才会变。
- 风险与回滚:只扩大订阅的子对象集合,最坏多一次父记录读取;推导路径与 12244 的行为不变;回滚即 revert 本 PR。
- 先看:`RecordDetailView.tsx` 中 `relatedChildObjectsKey` 那一段;新文件
`recordPageChildObjects.ts`;`RecordDetailView.authoredChildWriteRefreshesParent-26890.test.tsx`。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/RecordDetailView.authoredChildWriteRefreshesParent-26890.test.tsx`,预期
4 个测试全绿。
- 需要你做的:无,席位落地。
## What changes
- New `recordPageChildObjects(page)` beside the view: the child objects
a record page lists itself, read from every `record:related_list` block
(`properties.objectName`, or the node's `dataSource.object` binding that
the block's element data-source gate maps onto `objectName`) and every
`record:reference_rail` entry's `objectName`, at any depth of the page.
Sorted and deduplicated.
- `RecordDetailView`'s child-write subscription (objectui#12244) now
watches the union of the derived related lists' children and those,
still keyed by content (AGENTS.md #10). Nothing else in the view moves.
## Why
objectui#12244 re-reads the parent on a child write, but it watched only
the children `deriveRelatedLists` derives from the relationship graph.
An authored record page declares its own lists, and a child it lists
there need not be derived: its FK can opt out of the derived lists with
`relatedList: false`, the authored page then being the only place the
child is shown. A create, edit or delete through such a list reached the
invalidation bus under the child's name and matched nothing, so the
header kept the pre-write rollup until a reload, as the card reports.
Reproduced first on `origin/main` `cbb3a1a1` with the new test file: the
create, update/delete and rail cases were red (`expected 1 to be 2`
parent reads). A one-off control copy of the same file without
`relatedList: false` (child derivable from the graph) was green on those
three cases on the same tree, so the gap is specific to a child the
authored page alone declares. HotCRM's own quote-line metadata was not
read here (it lives outside this repository), so whether its FK carries
`relatedList: false` is not measured; the fix covers the shape the
dispatch named.
## Tests
- New
`RecordDetailView.authoredChildWriteRefreshesParent-26890.test.tsx` (4
tests, real page + real MutationEvent bridge, a fake backend that
recomputes the rollup): a create of a line listed only by the authored
related list re-reads the parent once and the header shows the new total
in place; an update and a delete each re-read it; a write to a child
listed only in the reference rail re-reads it; a write to a child that
points at the parent but is listed nowhere does not.
- New `recordPageChildObjects.test.ts` (2 tests): every related list and
rail entry at any depth including the `dataSource.object` arm, sorted
and once; other blocks' objects (`element:chart`, `record:line_items`)
and non-string values are not named.
- `RecordDetailView.childWriteRefreshesParent-12244.test.tsx` still
green (5/5) beside the new file.
- Ablation (one-off, not kept): with `, ...authoredChildObjects])`
replaced in `RecordDetailView.tsx` via `scripts/ablation-replace.mjs`
(anchor 1 → 0, mutation blob landed, restored blob equal to HEAD, `git
diff HEAD` empty), the new page file goes 3 failed / 1 passed: create,
update/delete and rail red, the scope control green.
## Acceptance notes
- The subscription covers what the authored page lists, not every object
a page binds: a chart or metadata viewer on the record page is not a
child list, and a write to its object does not re-read the record.
- `record:line_items` on a record page is not added: its save writes the
parent leg too, which the record's own invalidation already catches.
## Verification
On head `24529675` (main merged): 24 gates derived by `node
scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`, exits captured before any pipe;
`check-sdui-manifest` 0. 23 exit 0; `pnpm --dir ui exec vitest run
scripts/` exited 1 on three tests in `check-i18n-dead-keys.test.ts` and
`check-vi-mock-inherit.test.ts` that timed out at 15 s while another
suite shared the box (5031 others passed); those two files rerun alone:
223/223 passed. `--ran` reconciles 24 derived / 24 run / 0 NOT-MEASURED.
The whole `RecordDetailView*` suite plus the helper test: 76 files, 505
tests passed. Extra: `pnpm --filter @object-ui/app-shell run type-check`
0, eslint on the four touched files 0 errors (warnings pre-existing,
none on touched lines), `pnpm --dir ui run check:new-line-citations` 0
new. `@object-ui/app-shell` is `private: true`, so `skip-changeset`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbZdCt7JoRJa32i5BHs)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 17c34b8 commit 1900c02
4 files changed
Lines changed: 500 additions & 3 deletions
File tree
- ui/packages/app-shell/src/views
| 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 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 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 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
1851 | 1852 | | |
1852 | 1853 | | |
1853 | 1854 | | |
1854 | | - | |
1855 | | - | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
1856 | 1862 | | |
1857 | 1863 | | |
1858 | 1864 | | |
| 1865 | + | |
1859 | 1866 | | |
1860 | | - | |
| 1867 | + | |
1861 | 1868 | | |
1862 | 1869 | | |
1863 | 1870 | | |
| |||
0 commit comments