perf: full session list (limit 10000) refetched on every session open #461
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#461
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Code-quality audit (P2).
frontend/src/pages/session-detail/SessionDetail.tsx:383-392.Why it matters
Opening any session fetches up to 10,000 session rows to serve three small needs:
:392),:395-407) — an O(depth x n) fixpoint loop over the whole list,:725).The full payload is then held in component state for the lifetime of the page. Each of those 10,000 rows is a
GetSessionsrow, which on the backend costs 11 correlated subqueries (see theGetSessionsticket) — so this is the client-side amplifier of that query. Every session open pays it.Suggested fix
Add
GET /api/session/{id}/treereturning just the ancestors and descendants of one session, and have the backend compute the closure in SQL (recursive CTE onparent_id). Failing that, reuseapiStore.cachedSessionsinstead of refetching, and drop thelimit: 10_000.Acceptance criteria
Effort: M.