Skip to content

refactor(frontend): route refresh-work-items through one reconciliation (WI-1924) - #435

Merged
stefan-ernst merged 1 commit into
mainfrom
wi-1924-refresh-work-items
Nov 2, 2026
Merged

stefan-ernst merged 1 commit into
mainfrom
wi-1924-refresh-work-items

Conversation

@stefan-ernst

Copy link
Copy Markdown
Contributor

Why

The global refresh-work-items broadcast had seven independent window listeners, so one mutation started several unrelated reads:

Surface Before
Homepage lifecycle + Homepage two listeners (invalidate + refresh)
Collections (list/board/backlog) own listener each (already coalesced)
Item SLA panel own listener, and bypassed slaState with a direct sla.getItemSLA
SLA badge own listener, one reload per mounted badge
Item detail children own listener (parent-scoped)

The panel's direct read duplicated the workspace batch the badges already use, and every badge refetched on any burst regardless of workspace.

What

New stores/workItemRefresh.js — owns the single refresh-work-items listener, merges a burst into one notification (accumulating every item/parent id), and notifies each subscriber once. Exposes onWorkItemRefresh, workItemRefreshTouchesWorkspace, and a test-only reset.

Migrated to subscribe: homepage lifecycle, Homepage, ItemDetail, CollectionList/Board/Backlog, ItemSLAPanel, SLABadge. The only remaining raw listener is slaState's synchronous cache clear, so the cache is invalidated before the debounced subscribers reload.

SLA surface: ItemSLAPanel now reads through slaState.getItemSLA(itemId, workspaceId) (it gets workspaceId from ItemDetailSidebar), so the panel and badges share one batch per workspace. Both skip a burst that names another workspace.

Result

  • One event → one collection delta, one homepage snapshot, one child reload (when the parent matches), one SLA batch per affected workspace.
  • A burst coalesces into one notification instead of one per event.

Verification

  • bun run check, bun run typecheck — pass
  • Full ../core-tests frontend suite — 437 files, 3268 tests pass
  • New tests: coordinator unit suite; SLA reconciliation suite (panel + badge share one batch, one event reconciles once, other-workspace burst skipped)

Pairs with Windshiftapp/core-tests-internal#33.

…on (WI-1924)

Seven surfaces listened to the global refresh-work-items broadcast
independently, so one mutation started several unrelated reads: the
homepage snapshot, the item SLA panel, every SLA badge, child items and
the collection delta. The SLA panel also bypassed slaState and issued its
own per-item read, duplicating the workspace batch the badges already use.

Add a workItemRefresh coordinator that owns the single listener, merges a
burst into one notification, and notifies each subscriber once. Migrate
the homepage lifecycle, homepage, item detail, collection views, SLA
panel and SLA badge to subscribe to it. The panel now reads through
slaState so it shares the workspace batch with badges, and both skip a
burst that names another workspace.

Cache invalidation stays a synchronous window listener in slaState so the
cache is cleared before the debounced subscribers reload.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Size Change: 0 B 🆕

Total Size: 0 B

compressed-size-action

@stefan-ernst
stefan-ernst merged commit a62e322 into main Nov 2, 2026
21 checks passed
@stefan-ernst
stefan-ernst deleted the wi-1924-refresh-work-items branch November 2, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant