Skip to content

fix(app): load workspace sessions by directory - #44027

Merged
Brendonovich merged 2 commits into
anomalyco:v2from
OpeOginni:workspace-session-loading
Aug 22, 2026
Merged

fix(app): load workspace sessions by directory#44027
Brendonovich merged 2 commits into
anomalyco:v2from
OpeOginni:workspace-session-loading

Conversation

@OpeOginni

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #44022

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Stops Settings → Workspaces from freezing the app.

Before: the page fetched every session on the server (serial 100-per-page pagination, no filter) and wrote each one into the store with an unbatched session.remember, so every write re-ran the sorted-sessions memo — O(N² log N) main-thread work that locked the whole UI.

Now: sessions are fetched per workspace directory (the session.list API already supports a directory filter), requests run in parallel, and the store writes are wrapped in Solid's batch() so memos/subscribers update once per fetch. The delete preflight fetches only the target workspace's sessions. Displayed counts still come from the same sessionsForWorkspace prefix match over the store, so rendering behavior is unchanged.

How did you verify your code works?

  • Tested against a copy of my real production database (12 GB, ~1,600 sessions). Without the fix, opening Settings → Workspaces pages through all ~1,600 sessions in serial requests and freezes the whole app for several seconds. With the fix, the page opens instantly and counts/last-active times match the unfixed version.
  • bun test src/session/list.test.ts and bun run typecheck in packages/app pass.

Screenshots / recordings

BEFORE

639754013-2c7267c2-2fa2-469e-94dc-152c5ca8cf4e.mov

AFTER

Screen.Recording.2026-08-22.at.01.59.35.mov

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@Brendonovich
Brendonovich enabled auto-merge (squash) August 22, 2026 07:41
@Brendonovich
Brendonovich merged commit 85f32fa into anomalyco:v2 Aug 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants