Skip to content

fix(web): fix Mark unread that was immediately reseting on the active thread - #4875

Closed
ojowwalker77 wants to merge 2 commits into
pingdotgg:mainfrom
ojowwalker77:agent/fix-mark-unread-feedback
Closed

fix(web): fix Mark unread that was immediately reseting on the active thread #4875
ojowwalker77 wants to merge 2 commits into
pingdotgg:mainfrom
ojowwalker77:agent/fix-mark-unread-feedback

Conversation

@ojowwalker77

@ojowwalker77 ojowwalker77 commented Jul 29, 2026

Copy link
Copy Markdown

What Changed

Stops the active chat view from reacting to manual unread timestamp changes. The visit effect now runs only when the active server thread or its update timestamp changes.

Why

Marking a thread unread changes its last-visited timestamp. The active chat subscribed to that same value, which retriggered the visit effect and immediately marked the thread as read again.

The existing store action already validates and deduplicates visit timestamps, so the extra subscription and guard were unnecessary. Opening the thread again or receiving a newer thread update still marks it as read normally.

Fixes #4873

UI Changes

Before

Screen.Recording.2026-07-29.at.18.26.21.mov

Mark the currently open thread unread.
The local unread timestamp changes.
That change retriggers the active thread’s “visited” effect.
It instantly becomes read again, forcing you to leave the thread first.

After

Screen.Recording.2026-07-29.at.18.26.56.mov

You can mark the active thread unread without leaving it.
It immediately keeps the visible unread/Done state.
Ordinary rerenders do not clear it.
It clears when you leave and reopen the thread, or when genuinely new thread activity arrives.

Validation

  • vp test run apps/web/src/uiStateStore.test.ts apps/web/src/components/ChatView.logic.test.ts
  • vp run --filter @t3tools/web typecheck
  • vp fmt --check apps/web/src/components/ChatView.tsx
  • vp lint apps/web/src/components/ChatView.tsx --report-unused-disable-directives
  • git diff --check origin/main...HEAD
  • Desktop dev build and launch

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after evidence for the UI change
  • I included a video for the interaction change

Note

Low Risk
Small UI-state fix in ChatView with existing store deduplication; no auth, data, or API changes.

Overview
Fixes Mark unread on the currently open thread being undone immediately.

ChatView no longer subscribes to threadLastVisitedAtById for the active route. The visit useEffect also drops the guard that skipped markThreadVisited when the stored last-visited time was already at or past serverThread.updatedAt.

The effect now runs only when the active server thread’s id, environment, or updatedAt changes, and always delegates to markThreadVisited (which already ignores backwards or invalid timestamps). Manual unread updates no longer retrigger the effect, so the thread stays unread until you leave/reopen or newer server activity bumps updatedAt.

Reviewed by Cursor Bugbot for commit ef8d149. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix "Mark unread" immediately resetting on the active thread in ChatView

The ChatViewContent component was comparing lastVisitedAt against serverThread.updatedAt before calling markThreadVisited, which caused a mark-unread action to be immediately overwritten when the thread was active. The fix removes this comparison so markThreadVisited is called unconditionally whenever a server thread with an id is present, regardless of any previously recorded timestamp.

Macroscope summarized ef8d149.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e57e250-1751-4896-bdc8-ed98c52318b2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ojowwalker77
ojowwalker77 marked this pull request as ready for review July 29, 2026 21:49
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 29, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved bc49293

Straightforward bug fix that removes a conditional check which was causing 'Mark unread' to immediately reset when viewing a thread. The change is small, focused, and has clear intent.

You can customize Macroscope's approvability policy. Learn more.

@ojowwalker77

Copy link
Copy Markdown
Author

hi @juliusmarminge could we take a quick look at this ? its a super tiny change with a significant ux gain for me

@t3-code

t3-code Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

closing as superseded by #5486. that merged change removes the visit effect which immediately reset unread state on the active thread, addressing the bug through explicit thread actions instead. thanks for the fix.

@t3-code t3-code Bot closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Mark unread immediately resets on the active thread

1 participant