Repository navigation
fix(components): a related-list tab badge keeps following its list after a row action - #36953
Conversation
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB
…on a held count Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziG2t1d9cfRQJDrHkB
|
repo:objectstack#3 · os-support-ai · session_01WGufzesUz1Y8VZuKJRhVL8 席位核对 — ACCEPT · repo:objectstack#3 · head 6d5352d · 2026-11-24T11:19ZL1 read of #36953 (card #36922, p1) at The cause holds against the code. The fix. Tests. The hook suite drives the real bus through the store into Card coverage. Expected: badge and list agree after a row action, delete or create. Delete and create are pinned and live-checked (the readings table, main vs branch). A header action is not checked and is stated as such. It goes through the same store path, which is acceptable. Changeset. It names Mechanical. All-checks: 45 success · 13 expected skips · 0 failed · 0 pending. Floor checks are green, No open finding. ACCEPT, ordinary queue landing. |
|
repo:objectstack#3 · os-support-ai · session_01WGufziG2t1d9cfRQJDrHkB Landing: 2026-11-24T11:20Z · area ux-C · p1 · head
State: ready + auto-merge (merge queue). |
Requested by Yibo Wang · project thread
Fixes #36922
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
RelatedCountStore.fetch(@object-ui/components) now settles on a count the store holds. When a change overtakes the read a fetch joined (an invalidation,invalidateAll, a newer seeded read, or a rail card'sreleaseRows), the read is markedovertakenand the fetch takes the count a newer read installed, joins the read now in flight, or reads again. A read that fails without being overtaken still answers0with nothing cached.Why
Measured on
main(4f19091) in a browser, showcase app, Projects → open a project in the drawer → Tasks related tab:Mark Done, a flow-freeupdate) reaches the data-change bus twice, a beat apart: the dataSource write's own mutation event, thennotifyRelatedChangedfromRelatedRecordActionsBridge.runRowActiononce the runner returns.useRelatedCounts(the record page's tab-badge reader,plugin-detail) send a re-count. The second change overtakes it while it is out:invalidatedrops the in-flight entry, so the read installs no count when it answers.fetchstill resolved with that read's number.useRelatedCountsreads "resolved and nothing cached" as a failed read and adds the key to its per-parent failed set. A failed key is never asked again for the record open, and the badge draws its last known number.A plain delete reaches the bus once, so no read is overtaken; that is why the control in the issue refreshes. The page-tabs badge (
page:tabs, an authored page) is not affected: it re-fetches on every store version and keeps no failed set.Fixed at the store, not the reader:
fetchanswering with a number for data that has changed, without caching it, is the contract gap; with it closed, the reader's inference ("resolved and nothing cached" = failed) is true again. No public type or accept set changes.Tests
ui/packages/plugin-detail/src/__tests__/useRelatedCounts-27056.test.tsx, new top-leveldescribe(objectstack#36922): drives the real bus (notifyDataChanged) through the store intouseRelatedCounts. Row action (two changes, the second while the re-count is out) then delete → re-counted to 8; row action then create → re-counted to 10; plain-delete control → 8.ui/packages/components/src/__tests__/related-count-store.test.ts, new top-leveldescribe: an overtaken fetch reads again and resolves with the installed count; it joins a newer caller's read instead of sending a third; a non-overtaken failure still answers0with nothing cached.Red on main, green with the fix, ablation
Tests 2 failed | 9 passed (11)— both row-action pinsAssertionError: expected 2 to be greater than 2(no read after the delete/create); the plain-delete control passes.Test Files 6 passed (6),Tests 48 passed (48)(the hook file plus all fiverelated-count-store*suites).type-checkof@object-ui/componentsand@object-ui/plugin-detail(both programs, source andtsconfig.test.json): exit 0 after building their dependency closure.scripts/ablation-replace.mjs(anchorif (!pending.overtaken) return total;→return total;, anchor x1 → x0, blob da95bc4e → a2897c4f):Tests 4 failed | 18 passed (22)— the four new overtaking pins red, both controls green; restored blob == HEAD,git diff HEADempty. Both suites import the store from source (the hook suite went red → green on acomponents/src-only change), so no build sits between the mutation and the run.Acceptance notes
useRelatedCountsstill never re-asks a key whose read really failed, for the rest of the record open, and draws its last known count meanwhile. That is unchanged and out of this card (no measured repro).Verification
Browser, showcase on its own port (
objectstack dev --seed-admin --fresh), Console fromui/source through Vite, drawer on a project's Tasks tab, the issue's exact sequence:Readings
Mark Doneon one row, then Delete another, read 7 s laterMark Done, then DeleteMark Done, then Add → saveOn main the row action sent one count read (the overtaken one) and the delete sent none; with the fix the row action sends two (the overtaken one, then the re-read) and the delete one more. Time from the tab drawing to its badge on a fresh load is unchanged (170–600 ms with the fix, 230–450 ms with the fetch loop ablated, dev-server Vite on a shared box).
Read first:
ui/packages/components/src/hooks/related-count-store.ts— thefetchCountloop and theovertakecall sites (theseedandreleaseRowsones change behaviour too: a fetch that joined a replaced read now follows the newer read instead of answering with the old one).Two-minute check: open a project in the drawer on its Tasks tab, run
Mark Doneon one row, then delete another row — the tab badge drops by one with the list.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses (eslint run on the changed files; the repo-wide run is CI's).main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code