Skip to content

fix(grid): a grouped row moves to its new group once its row is left, and group subtotals and the footer total follow a cell save (#35689 slice B) - #36476

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35689-group-refresh
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35689-group-refresh

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #35689 — slice B (groups and totals after a save). Slice A (touch, accessibility, checked rows) landed earlier on its own PR, so nothing else on the card is left.

Clause-②: no
Metadata-protocol: none

维护者速读

  • 列表页按阶段分组时,把一条的阶段从甲改成乙:停在这一行时它不动,点到别的行后它出现在乙组,两组的条数和金额小计都对;改金额后分组小计和表尾合计马上更新。
  • 列表行内编辑重做专题的最后一块(分组与合计随保存更新),这张卡至此做完。
  • 出错时最坏是分组小计或表尾合计显示旧数字、或这一行要刷新后才换组,保存的数据本身不受影响;可以直接撤回。
  • 无

What changes

Measured first on origin/main 285ad8d, in a list that selects a cell first (the list page's grid), with the card-named pins below run against the unchanged source:

Card item Server grouping Browser grouping Premise
A row whose stage changed moves to its new group after the user leaves the row did not move did not move holds: broken
Group counts and amount subtotals after the save not refreshed not refreshed holds: broken
Footer total, flat grid whose rows are the whole set not refreshed n/a holds: broken
Footer total, grid paged on the server (whole-set figure) already re-read after a write n/a false: works on main, pinned only

Why: a select-first save redraws only its own row (the row patches of #35685) and the list lets its own write go by on the bus, so nothing is read again. The groups, the group headers' numbers and the footer's row figures read the rows as loaded, not as saved. The whole-set footer listens to the bus itself, so it already re-asked.

What this PR does, all in @object-ui/plugin-grid:

  • The figures read the saved rows. rowsAsSaved (in objectGridRowPatch.ts) gives the rows with each saved row in place of the one read, while that read is the one held. The footer reads it, so a flat grid's total includes the saved value at once. A grid that groups the rows it was handed buckets it, so its counts and subtotals follow the save.
  • A row whose save changed a grouping field is held in its group until the row is left. writeRowInPlace notes such a record in heldInGroup. The browser bucketing reads that record as it was loaded (it stays in its group, counted and summed there). onCellSelect on a cell of another row lets it go: the browser bucketing then moves it, and a server-grouped grid reads its group headers and open groups' rows again (regroupNonce). A cell of the same row does not let it go. Any later save on a held row waits with it.
  • Any other save in a server-grouped grid re-asks only the headers (savedFigureNonce), so subtotals update at once and no row is read again. objectGridGrouping.ts now keys the header query on that nonce and the row pages on regroupNonce alone.
  • A grid without the select-first model still reads everything again after each save, as before (control pin).

Docs: content/docs/frontend/plugins/plugin-grid.mdx gains one bullet under the per-cell save section. Changeset: @object-ui/plugin-grid patch.

Tests

One new top-level describe in the component's existing select-first save harness, ObjectGrid.autosave-35685.test.tsx: "ObjectGrid — groups, subtotals and the footer total after a cell save (objectstack#35689)". It covers both grouping paths: the server, where the grid asks its own group headers and group pages, and the browser, where it buckets rows a host hands it.

  • Card line 「离开这一行后它出现在乙组,两个组的条数和金额小计正确」, on each path: a stage pasted from Prospect to Won keeps the row in Prospect, with both groups at their old figures. A click on another cell of the same row keeps it there too. A click on a cell of another row moves it to Won, and the groups read Prospect 1 · 100 and Won 2 · 80.
  • Card text 「分组小计…随保存更新」, on each path: an amount saved is in its group's subtotal at once. No row is read again. A server-grouped grid asks its headers exactly once more, and a browser-grouped one asks nothing.
  • Card line 「表尾合计在改了金额后更新」: in a flat grid whose rows are the set, the footer sum goes from 180 to 200. In a grid paged on the server, the whole-set footer is read again and reads 200 (this holds on main and is pinned only).
  • Control: without cellSelection, a write on the bus re-reads the grouped grid at once.

Ablations: one run per leg through scripts/ablation-replace.mjs. Every anchor hit x1 and went to x0, and every restore came back to the HEAD blob f5aebf14 with git diff HEAD empty. The suites import the grid by relative path (source), so no dist leg was owed:

Leg Mutation Red
A1 onCellSelect no longer lets a held row go 2: the move pin on both paths
A2 no header re-ask on a save 1: server subtotal
A3 the grouping reads the loaded rows 2: browser move and browser subtotal
A4 the footer reads the loaded rows 1: flat footer
A5 a held row is bucketed as saved 1: browser hold before leaving
Readings (all through scripts/pm/os-verify-lock.sh)
Gates

Acceptance notes

  • "Leaving the row" means selecting a cell of another row (a click, the arrow keys, Tab across the row's end). Escape, or a click outside the grid, keeps the row selected, so it stays in its group until another row is selected or the list loads again.
  • When a server-grouped grid regroups on leaving a row, it reads the open groups' rows again, so a group pager turned past page 1 starts over at page 1, as on any refresh.
  • A held record stays noted after a later full load. The next time a row is left, the groups are read one extra time. That read is harmless.

Verification

Files to read first, by risk:

  1. ui/packages/plugin-grid/src/ObjectGrid.tsx: noteSavedPlace, leaveHeldRows, and the savedData and groupedData memos.
  2. ui/packages/plugin-grid/src/objectGridGrouping.ts: the header and row reload keys.
  3. ui/packages/plugin-grid/src/objectGridRowPatch.ts: rowsAsSaved.

Two-minute check: pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/ObjectGrid.autosave-35685.test.tsx. Expect 29 passed, including the seven under "(objectstack#35689)".


Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jUc3qp6bHKSWijbjds

Final head (area f7-list, 2026-11-22T13:40Z): 1285fe44a5bdfac2894eb5f2955cb003e7efa501. CI on it: 48 success and 10 skipped, 0 failed. Dev report 7079758673 on #35689. Route: slice B. Groups and footer totals now read the rows as saved. A select-first save that writes the grouping field keeps the row in its group until a cell of another row is selected, and then it regroups. Other saves re-ask only a server-grouped grid's headers. The paged whole-set footer was already re-read, so it is pinned only. Clause-②: no: no export, no GridCellSelection member, no i18n key. No contract face, so L1 only. 364 changed lines, 6 files. The claim amendment for content/docs/frontend/plugins/plugin-grid.mdx is on the card. L1 requested from L1-d via seat repo:objectstack#7.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jS7jCv5PH4ytECQWqf

L1 ACCEPT · head 1285fe44a5bdfac2894eb5f2955cb003e7efa501 · 2026-11-22T13:47Z

维护者速读

席位核对

  • 卡片关系:首行 Fixes #35689。第一片 feat(grid): read-only cells say so in the grid, a cell save is said in one live region, a touch never edits in place (#35689 slice A) #36332 已于 11-22 11:52Z 合并。我读了它的标题:只读格读出只读、保存结果用一个朗读区播报、触屏不在原地编辑。卡上触屏、无障碍、选择列三块都在那一片里。本 PR 交付第四块「分组与合计」,所以合并后卡就完整了,Fixes 是对的。

  • 先测前提:正文在 origin/main 285ad8d 上,用新测试测过卡上的每一条。分组换组、分组小计、平铺表尾合计在 main 上都是坏的,新 describe 在 main 源码上 5 条失败。服务端分页的整集表尾,在 main 上本来就会重读,正文写明了「只加钉子」。前提核得清楚。

  • 代码:

    • objectGridRowPatch.ts 新加 rowsAsSaved。它把保存过的行替换进读到的行,只在读到的那份仍是被替换的基准时才换(patch.base !== row 就不换)。waiting 里的记录保持读到的样子。
    • ObjectGrid.tsx 里,表尾读 savedData,浏览器分组读 groupedData,后者把 heldInGroup 里的行按读到的样子保留。
    • noteSavedPlace 只在分组时起作用。改了分组字段,就把记录记进 heldInGroup;已经在里面的,后面的保存也一起等着;其余的保存,在服务端分组时让 savedFigureNonce 加一。
    • onCellSelect 调 leaveHeldRows:选到同一行的格不放;选到别的行,放掉,并让 regroupNonce 加一。
    • objectGridGrouping.ts 把表头的重读键和行的重读键分开了:savedFigureNonce 只让表头重读,regroupNonce 让表头和打开的分组的行一起重读。
    • 这些改动逻辑一致,和正文的说明对得上。
  • 声明:Clause-②: no 对,没有新的 prop、导出或元数据键,新函数都是包内的。Metadata-protocol: none 对。不欠 Skills-docs,也不欠 dogfood。

  • changeset 和文档(逐句核):

    • @object-ui/plugin-grid 有 patch 条目,三条说法和代码一致:「换了分组字段,停在这行时不动,选到别的行时换组,服务端分组时重读表头和打开的分组的行」「其他字段的保存马上进小计,服务端分组只重读表头、不重读行」「平铺表的表尾马上算进去,服务端分页的整集表尾本来就会重读」。末句「不先选格的网格照旧每次保存后全部重读」,有对照用例钉着。
    • plugin-grid.mdx 新加的那一条和 changeset 一致。上一条「列表不重读,所以按新值本该排到别处的行会留在原地,直到下次加载」说的是排序,仍然成立。
    • 小瑕疵,不阻塞:文档和 changeset 写「其他字段的保存马上进小计」,但一行还停在原组时,它后面的保存也会跟着等,要到离开这一行才算进去。正文 Verification 前的说明写到了这一点(「Any later save on a held row waits with it」),changeset 里没写。
  • 测试:新 describe 有 7 条,放在已有的先选格保存测试里,服务端分组和浏览器分组两条路径都覆盖了:

    • 换组:同一行的另一格不放,别的行才放,放后是 Prospect 1 · 100、Won 2 · 80;
    • 小计:不重读行,服务端分组时表头只多问一次;
    • 平铺表尾从 180 变成 200,服务端分页的整集表尾也是 200;
    • 对照:没有 cellSelection 时,总线上的写入会马上让分组网格重读。

    五处消融(A1–A5)各让它对应的用例变红,复原后 blob 等于 HEAD,git diff HEAD 为空。

  • Acceptance notes:「离开这一行」的定义写明了:点击、方向键、Tab 跨出行尾都算,Esc 和点到网格外面不算。服务端分组重读时,翻过页的分组会回到第 1 页。被保留的记录在全量重载后仍然记着,下一次离开行时多读一次分组,没有害处。这三点都是如实说明,我认。

  • CI @ 1285fe44:48 success、10 skipped、0 failed;不在治理面。

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jUc3qp6bHKSWijbjds

Landing (area f7-list, 2026-11-22T13:53Z): head 1285fe44a5bdfac2894eb5f2955cb003e7efa501 · L1 ACCEPT 7080068263 (L1-d; no L2 owed: Clause-②: no, no contract face) · check-governed-merges --pr 36476: NOT governed, 364 changed lines ≤ 3000 · CI on the head: all success/skipped, 0 failed · mergeable clean. → pr_ready + automerge_enable (merge queue). Carried, not filed: a row counts as left only when a cell of another row is selected (Escape or an outside click keeps it in its group); a server-grouped regroup resets group pagers to page 1 (PR Acceptance notes).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 13:53
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit d8b15b5 Nov 22, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35689-group-refresh branch November 22, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

行内编辑收尾:触屏平板、无障碍、分组与合计随保存更新、与勾选的配合

2 participants