feat(desktop): thread unread indicators#1023
Merged
wpfleger96 merged 5 commits intoJun 13, 2026
Merged
Conversation
Extend the channel-level unread system (PR #1008) to threads: 1. Thread read-state model: getThreadReadAt/markThreadRead in AppShellContext delegate to ReadStateManager with thread:<rootId> context keys, giving cross-device sync via NIP-RS for free. 2. Thread unread count badge: computeThreadUnreadMarker counts replies after the thread read frontier. MessageThreadSummaryRow renders a blue numeric badge when unreadCount > 0. 3. In-thread "New" divider: MessageThreadPanel captures the thread frontier on open (openFrontierRef pattern matching channel screen), computes firstUnreadReplyId, and renders UnreadDivider above it. Suppressed when the first unread is the first reply (index 0) to avoid a meaningless boundary. Mark-read fires immediately on thread panel open using the latest reply timestamp. Thread with 0 replies is a no-op. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Only persist thread read-state for threads the user has notification interest in (participated, authored, or followed). Opening a thread with no stake no longer creates a context key, preventing unnecessary blob growth. Add bounded eviction in currentContexts(): when publishable contexts exceed 8,000, evict oldest thread:* entries by timestamp. Channel keys are never evicted. This prevents silent blob rejection when the 10,000 MAX_CONTEXTS cap is approached. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Apply biome formatter rules: multi-line imports, multi-line dependency arrays, single-line short conditions. Replace eslint-disable comment with biome-ignore for useExhaustiveDependencies (readStateVersion is an intentional invalidation signal for stable callbacks). Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Captures 3 screenshots for PR documentation: - Thread unread badge on summary row (participated thread) - New divider inside thread panel above unread replies - No badge for casual browsing (interest gate working) Follows the same pattern as unread-pill-screenshots.spec.ts. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Collaborator
Author
E2E screenshots — thread unread indicatorsCaptured from Thread unread badgeReturning to a channel with new thread replies shows a blue numeric badge on the thread summary row — only for threads the user has notification interest in (participated, authored, or followed). New divider in thread panelOpening a thread with unread replies shows the inline "New" divider above the first unread reply, marking where the user left off. No badge for casual browsingOpening a thread the user has no stake in (not participated, authored, or followed) does NOT show a badge — the interest gate prevents noise from casual browsing. |
wpfleger96
pushed a commit
that referenced
this pull request
Jun 13, 2026
The nested reply visibility assertion (nestedReplyVisibleTopMaxPx) needs to accommodate the UnreadDivider that now renders above unread replies when reopening a thread with a read frontier. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Collaborator
Author
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.



Summary
Extends the channel-level unread system (PR #1008) to threads with three affordances:
Thread read-state model —
getThreadReadAt(rootId)andmarkThreadRead(rootId, timestamp)inAppShellContext, delegating toReadStateManagerwiththread:<rootId>context keys. Cross-device sync via NIP-RS for free.Thread unread count badge —
computeThreadUnreadMarkerinunreadMarker.tscounts replies after the thread read frontier.MessageThreadSummaryRowrenders a blue numeric badge whenunreadCount > 0.In-thread "New" divider —
MessageThreadPanelcaptures the thread frontier on open (sameopenFrontierRefpattern as the channel screen), computesfirstUnreadReplyId, and rendersUnreadDividerabove it. Suppressed when the first unread is the first reply (index 0).Behavior
frontierSeconds === null(thread never read) → all replies are unreadFiles Changed
desktop/src/app/AppShellContext.tsx— addedgetThreadReadAt,markThreadReadto context typedesktop/src/app/AppShell.tsx— wired thread read-state callbacksdesktop/src/features/messages/lib/unreadMarker.ts— addedcomputeThreadUnreadMarkerdesktop/src/features/messages/lib/unreadMarker.test.mjs— 8 new tests for thread markerdesktop/src/features/messages/ui/MessageThreadSummaryRow.tsx—unreadCountprop + badgedesktop/src/features/messages/ui/MessageThreadPanel.tsx—firstUnreadReplyIdprop +UnreadDividerdesktop/src/features/channels/ui/ChannelScreen.tsx— thread frontier capture, mark-read effect, unread count computationdesktop/src/features/channels/ui/ChannelPane.tsx— prop threadingdesktop/src/features/messages/ui/MessageTimeline.tsx— prop threadingdesktop/src/features/messages/ui/TimelineMessageList.tsx— prop threading + pass to summary rowStack
This PR is stacked on #1008 (
duncan/in-channel-unread-pill).Stack: #1008 → this PR