1
0
Fork 0
polaris-task-force/src/components/frontend
Z8MB1E a0f767cc13 perf: cut queries per render and refreshes per realtime event
Under 10-12 concurrent users the app queued behind itself: every SSE
game-event/profile-update made each client run router.refresh(), i.e. a
full layout + page render at ~15-25 queries, and a mission completion
emitted one XP event per attendee row. Measured against production, no
single query is slow and the DB is small, so this targets render count
and per-render query count instead of indexes.

Fewer renders per event:
- GameTickRealtime: 250ms coalescing window -> 1s, hidden tabs skip the
  render and refresh once when shown again.
- Delete OperationsRealtimeRefresher (5 routes) and the duplicate
  useGameTick refreshers in ProductionPanel/SlotsPanel; the global
  subscriber already refreshes those routes.
- Presence heartbeats no longer broadcast (was O(N^2) per channel every
  15s for a lastSeen no surface renders).
- NavCore links opt out of prefetch: the layout is force-dynamic with no
  loading.tsx, so ~35 prefetched links per tab were 35 server renders.

Fewer queries per render:
- Qualification flags go through one cached, single-flight profile read
  instead of one query per auth check; invalidated on profile writes.
- Dedupe DIVISION_ADMIN_QUALIFICATIONS (5 identical lookups -> 1).
- Anchor the permission cache on globalThis so route bundles share it.
- Minigame registry: real TTL cache plus invalidation on write.
- New cachedConfig TTL cache for the shims/game-rules globals, with
  invalidation hooks; bank-account existence check stops hydrating.
- pg pool max 10 -> 20 (node-postgres default throttled concurrent
  renders).

Hot-path per-item work:
- Contribution grant sweep: one status write per batch, one bucket write
  and one name lookup per user, one existence query per source
  collection instead of ~5 queries per entry.
- Notifications bell: coalesced refetch, hidden-tab skip; mark-all-read
  filters by the actor instead of scanning 100 foreign unread rows.
- Polling loops (shipments, ledger, mission reminders, chip bank) pause
  while the tab is hidden.
2026-11-22 22:39:10 -05:00
..
account feat(awards): render ribbon devices as vectors with tier-driven auto-layout 2026-10-26 22:21:10 -04:00
analytics feat(analytics): add Microsoft Clarity analytics 2026-10-01 10:04:45 -04:00
announcements fix(rich-text): render full lexical formatting incl. colours across all fields 2026-11-18 13:10:26 -05:00
auth feat(auth): add return-URL flow for login redirects 2026-08-19 19:48:24 -04:00
awards feat(awards): render ribbon devices as vectors with tier-driven auto-layout 2026-10-26 22:21:10 -04:00
banking fix(banking): render currency emblem inline to stop the hydration mismatch 2026-10-12 23:04:29 -04:00
baseManagement perf: cut queries per render and refreshes per realtime event 2026-11-22 22:39:10 -05:00
blocks perf: cut queries per render and refreshes per realtime event 2026-11-22 22:39:10 -05:00
contributions feat(contributions): fade the XP hint out and polish the amount 2026-10-13 15:52:57 -04:00
dashboard feat(frontend): drop duplicate frame labels from mission detail cards 2026-11-02 13:06:27 -05:00
dev feat(dev): confirm gate before navigating to the dashboard in dev 2026-09-21 20:48:17 -04:00
events feat(event-log): hide routine tick events behind a toggle 2026-10-19 20:03:51 -04:00
garage fix(garage): always fit the vehicle bay grid to its container 2026-10-13 16:43:16 -04:00
helpdesk fix(rich-text): render full lexical formatting incl. colours across all fields 2026-11-18 13:10:26 -05:00
impersonation refactor(impersonation): replace page control with modal 2026-09-01 17:17:54 -04:00
intelligence perf: cut queries per render and refreshes per realtime event 2026-11-22 22:39:10 -05:00
interiors feat(interior): interiors screens, sidebar entry, and launch content seed 2026-10-20 18:33:43 -04:00
journals feat(contributions): fade the XP hint out and polish the amount 2026-10-13 15:52:57 -04:00
locker chore(locker): commit pending stock handling refinements 2026-10-25 21:23:40 -04:00
logistics perf: cut queries per render and refreshes per realtime event 2026-11-22 22:39:10 -05:00
map fix(rich-text): render full lexical formatting incl. colours across all fields 2026-11-18 13:10:26 -05:00
markers fix(modlists): send modlist files as downloads instead of inline views 2026-10-26 18:07:05 -04:00
market chore(locker): commit pending stock handling refinements 2026-10-25 21:23:40 -04:00
minigames perf: cut queries per render and refreshes per realtime event 2026-11-22 22:39:10 -05:00
notifications perf: cut queries per render and refreshes per realtime event 2026-11-22 22:39:10 -05:00
operations perf: cut queries per render and refreshes per realtime event 2026-11-22 22:39:10 -05:00
personnel fix(rich-text): render full lexical formatting incl. colours across all fields 2026-11-18 13:10:26 -05:00
profile fix(rich-text): render full lexical formatting incl. colours across all fields 2026-11-18 13:10:26 -05:00
projects feat(ui): searchable combobox across data-driven dropdowns 2026-09-17 16:28:17 -04:00
promotions feat(promotions): add promotion nominations and leadership transfers 2026-10-03 03:29:24 -04:00
realtime perf: cut queries per render and refreshes per realtime event 2026-11-22 22:39:10 -05:00
roster fix(mobile): resolve horizontal overflow and touch-only affordances 2026-10-12 20:17:21 -04:00
session fix(session): dismiss expiry warning toast when signed out or extended 2026-09-24 12:04:58 -04:00
shims feat(shims): add targeted client-side injections 2026-08-26 00:53:31 -04:00
storage perf: cut queries per render and refreshes per realtime event 2026-11-22 22:39:10 -05:00
story fix(rich-text): render full lexical formatting incl. colours across all fields 2026-11-18 13:10:26 -05:00
surveys fix(rich-text): render full lexical formatting incl. colours across all fields 2026-11-18 13:10:26 -05:00
techTree fix(rich-text): render full lexical formatting incl. colours across all fields 2026-11-18 13:10:26 -05:00
tours fix(mobile): meet the 24px tap-target floor across the app 2026-10-12 22:17:51 -04:00
transfers feat(promotions): add promotion nominations and leadership transfers 2026-10-03 03:29:24 -04:00
voiceover feat(voiceover): spoiler gate, pacing pattern, and recorder updates 2026-09-14 15:37:12 -04:00
wiki feat(wiki): replace textarea overlay with a CodeMirror markdown editor 2026-11-18 15:12:22 -05:00
AGENTS.md feat(wiki): replace textarea overlay with a CodeMirror markdown editor 2026-11-18 15:12:22 -05:00
ClientDate.tsx feat(ui): add ClientDate component for timezone-aware date rendering 2026-08-31 12:27:17 -04:00
LandingPage.tsx test(e2e): seed e2e user, serialize workers, and deflake specs 2026-09-30 18:43:29 -04:00
PayloadButtons.tsx feat: switch to Bun, add fonts and styling, update components and UI, add basic front-end 2025-12-16 23:26:52 -05:00
RichTextView.tsx fix(rich-text): render full lexical formatting incl. colours across all fields 2026-11-18 13:10:26 -05:00
SiteHeader.tsx feat(tours): add permission-aware guided tours with replay and device opt-out 2026-09-30 18:43:21 -04:00