fix(web): fix Mark unread that was immediately reseting on the active thread - #4875
fix(web): fix Mark unread that was immediately reseting on the active thread #4875ojowwalker77 wants to merge 2 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
ApprovabilityVerdict: 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. |
|
hi @juliusmarminge could we take a quick look at this ? its a super tiny change with a significant ux gain for me |
|
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. |
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.tsvp run --filter @t3tools/web typecheckvp fmt --check apps/web/src/components/ChatView.tsxvp lint apps/web/src/components/ChatView.tsx --report-unused-disable-directivesgit diff --check origin/main...HEADChecklist
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.
ChatViewno longer subscribes tothreadLastVisitedAtByIdfor the active route. The visituseEffectalso drops the guard that skippedmarkThreadVisitedwhen the stored last-visited time was already at or pastserverThread.updatedAt.The effect now runs only when the active server thread’s id, environment, or
updatedAtchanges, and always delegates tomarkThreadVisited(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 bumpsupdatedAt.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
ChatViewContentcomponent was comparinglastVisitedAtagainstserverThread.updatedAtbefore callingmarkThreadVisited, which caused a mark-unread action to be immediately overwritten when the thread was active. The fix removes this comparison somarkThreadVisitedis called unconditionally whenever a server thread with an id is present, regardless of any previously recorded timestamp.Macroscope summarized ef8d149.