Chat sidebar: client-side read/unread marker - #309
Open
arsenmuk wants to merge 1 commit into
Open
Conversation
A session shows an unread marker (bold title + accent dot) when its updated_at is newer than the last time you opened it and it isn't running -- i.e. it updated and stopped while you were elsewhere. Read-state is derived and client-only: per-session last-seen stamps + a first-run baseline in localStorage (readStorage.ts), no server change. Opening a session (or leaving one you were viewing) marks it read; the baseline keeps pre-existing sessions from all showing unread on first load. handleSessionRunning refreshes the session list when a backgrounded feed session stops, so its updated_at -- and the marker -- is timely. Scoped to the conversation feed; system/archived/search rows are unaffected.
There was a problem hiding this comment.
Pull request overview
Adds client-side read/unread tracking to the conversation sidebar.
Changes:
- Persists per-session read timestamps and a baseline in localStorage.
- Refreshes sessions when background runs stop.
- Displays bold titles and unread dots; clears stored state on logout.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
readStorage.ts |
Implements read-state persistence. |
sessionHandlers.ts |
Refreshes sessions after background runs. |
chatStore.ts |
Tracks and updates read state. |
authStore.ts |
Clears persisted read data on logout. |
SessionSidebar.tsx |
Renders unread styling and markers. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // browser. Only on a *deliberate* logout — an expired session must never | ||
| // take your unsent work with it. | ||
| clearAllDrafts(); | ||
| clearAllReads(); |
Comment on lines
+284
to
+287
| if (!msg.is_running | ||
| && msg.session_id !== get().activeSession | ||
| && get().sessions.some(sess => sess.id === msg.session_id)) { | ||
| get().loadSessions(); |
Comment on lines
+1123
to
+1125
| <span title="Unread — updated since you last opened it" className="shrink-0 flex items-center"> | ||
| <span className="h-2 w-2 rounded-full bg-accent" /> | ||
| </span> |
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.
Marks sessions that updated and stopped since you last opened them — bold title + a small dot in the sidebar. Client-only, no server change.
How it works
!active && !running && updated_at > max(lastSeen[id], baseline).lastSeen+ a first-runbaselinein localStorage (readStorage.ts, mirrorsdraftStorage); the baseline keeps a fresh browser from flagging every pre-existing session.switchSession).handleSessionRunningrefreshes the list when a backgrounded feed session stops, soupdated_atand the marker stay timely.Build green (
tsc -b && vite build), tests 99/99.Stacked on #305.