perf: Fix UI responsiveness under rapid interaction and streaming #3

Merged
dries merged 1 commit from feat/ui-responsiveness-wave1 into main 2026-05-03 19:34:37 +02:00
Owner

Summary

  • Replace setInterval(0) hot loop, RAF-coalesce three MutationObservers, and coalesce four notify pollers into one shared store — fixes the main-thread stalls during streaming and rapid clicking
  • Add AbortSignal to every API GET and migrate Dashboard, ProjectDetail, Stats, and Usage tabs to TanStack Query for automatic dedup, cancellation, and stale-while-revalidate
  • Cache per-message conversion in OcmanRuntimeProvider via WeakMap so streaming tokens only recompute the active message
  • Add batch /api/session/{id}/tasks endpoint replacing N per-task polling requests with one

Deferred

  • Session-detail LRU cache removal (deeply integrated with SSE flow, warrants its own PR)

Testing

  • 345 frontend tests pass (20 new), 180+ Go tests pass, all linters clean
## Summary - Replace `setInterval(0)` hot loop, RAF-coalesce three MutationObservers, and coalesce four notify pollers into one shared store — fixes the main-thread stalls during streaming and rapid clicking - Add AbortSignal to every API GET and migrate Dashboard, ProjectDetail, Stats, and Usage tabs to TanStack Query for automatic dedup, cancellation, and stale-while-revalidate - Cache per-message conversion in OcmanRuntimeProvider via WeakMap so streaming tokens only recompute the active message - Add batch `/api/session/{id}/tasks` endpoint replacing N per-task polling requests with one ## Deferred - Session-detail LRU cache removal (deeply integrated with SSE flow, warrants its own PR) ## Testing - 345 frontend tests pass (20 new), 180+ Go tests pass, all linters clean
perf: Fix UI responsiveness under rapid interaction and streaming
Some checks failed
CI / Frontend (pull_request) Successful in 51s
CI / Backend (pull_request) Successful in 59s
CI / Playwright E2E (pull_request) Failing after 2m44s
CI / Build (pull_request) Successful in 1m13s
CI / Frontend (push) Successful in 50s
CI / Backend (push) Successful in 2m30s
CI / Playwright E2E (push) Failing after 3m1s
Semantic Tag / tag (push) Successful in 3s
CI / Build (push) Successful in 1m10s
d8b2a18ed8
Wave 1 — quick wins:
- Replace setInterval(0) hot loop with Zustand selector effect (P0)
- RAF-coalesce three MutationObservers in AssistantThread (P1/P9)
- Coalesce four notify pollers into one shared store (P2)
- Add AbortSignal to Dashboard/ProjectDetail polls (P4 partial)

Wave 2 — cancellation and memoisation:
- Sweep AbortSignal through every api/store GET method (P4)
- Cache per-message conversion in OcmanRuntimeProvider via WeakMap (P3)
- Remove redundant cancelled flags where signals handle it

Wave 3 — structural changes:
- Add TanStack Query provider with sensible defaults
- Migrate Dashboard sessions/projects, ProjectDetail, Stats tab, and
  Usage tab to TanStack Query hooks (P4/P5)
- Add batch /api/session/{id}/tasks endpoint and migrate per-task
  polling loop to single request (P7)

The session-detail LRU cache removal (step 8.4) is deferred — it is
deeply integrated with the SSE-driven incremental update flow and
warrants its own PR. The pending-prompt TTL cache (step 9) was already
landed in commit 9912577.
dries merged commit d8b2a18ed8 into main 2026-05-03 19:34:37 +02:00
dries deleted branch feat/ui-responsiveness-wave1 2026-05-03 19:34:37 +02:00
Sign in to join this conversation.
No description provided.