fix(app): list sessions on fresh clients despite empty opened-projects registry (#288) - #289
Merged
Conversation
…s registry (#288) Two defects made all session history invisible in the Sessions dropdown and the home sessions list on any fresh client: 1. The dropdown and home aggregated only over the persisted opened-projects registry, which is empty until the user opens a project — a fresh browser/client then iterated zero directories and rendered the empty state even though child stores held the sessions. Fall back to the server's registered projects (GET /project hydration) for session listing only; the project switcher keeps its open/close semantics. 2. loadSessions recomputed the trim limit inside the fetch .then from the (fresh, empty) store, shadowing the fetch limit — trimming every root session older than SESSION_RECENT_WINDOW (4h) out of the store. Use the fetch limit as the floor. Verified on a live server: fresh headless client now lists the full history in the dropdown (previously 'Nothing here yet').
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #288.
What
Two defects made all session history invisible in the Sessions dropdown and the home sessions list on any fresh client (empty localStorage, no opened projects):
Empty opened-projects registry: both list surfaces aggregate only over the persisted opened-projects registry. A fresh client iterates zero directories and renders
Nothing here yet— even though the server's projects are hydrated (GET /project) and their sessions are fetched into child stores. The fix falls back to the server's registered projects for session listing only (sessionListDirectorieshelper); the project switcher's open/close semantics are untouched.Trim-limit shadowing:
loadSessionsrecomputed the trim limit inside the fetch.thenfrom the (fresh, empty) store, shadowing the fetch limit. With limit 0,trimSessionskeptroots.slice(0, 0)and only therecentpath rescued sessions updated withinSESSION_RECENT_WINDOW(4h) — silently dropping all older history from the store. The fetch limit is now the floor.Verification
Nothing here yet; after the fix it lists the full history (55 sessions, newest first).bun typecheckclean inpackages/appandpackages/opencode;sessionListDirectoriesunit tests added; unit suite green except a pre-existingi18n parityfailure that fails identically on the pristine branch.isRootVisibleSessionwhen replayed) — the failure was strictly between fetch and render.Notes
--no-verify: the pre-push hook's repo-root typecheck segfaults (tsgo/turbo SIGSEGV, toolchain crash); the per-package typecheck passes cleanly.loadSessionsfor fallback directories whose stores are empty (bootstrap: falsereads would otherwise stay empty on a fresh client).