Preserve thread visited state across partial syncs#2506
Preserve thread visited state across partial syncs#2506hogeheer499-commits wants to merge 1 commit intopingdotgg:mainfrom
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 Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 Straightforward bug fix that preserves thread visited state across partial syncs by removing incorrect pruning logic. The change is small, localized, and includes updated tests verifying the expected behavior. You can customize Macroscope's approvability policy. Learn more. |
852728f to
60a6d68
Compare
Dismissing prior approval to re-evaluate 60a6d68
|
Adding the original reporter error details here as reviewer context. The screenshot showed the T3 Code Alpha error boundary with this expanded stack: This is the reason I focused this PR on the |
What changed
threadLastVisitedAtByIdentries whensyncThreadsreceives a partial snapshot that does not include a thread.threadChangedFilesExpandedById.Why this should exist
This is a small, focused frontend state bug fix.
A production crash report showed React error 185 with
markThreadVisitedin the stack. On currentmain,ChatViewcallsmarkThreadVisited(threadKey, completedAt), butsyncThreadscould delete that completed-turn timestamp when a partial/recovery snapshot omitted the active thread. After that, the same completed turn could be marked visited again instead of remaining idempotent.The regression test proves the exact state transition:
completedAtsyncThreads([])as a partial snapshotmarkThreadVisited(thread, completedAt)againWith the old pruning behavior, the timestamp is lost. With this change, it is preserved and the second mark returns the same state object.
Scope
Validation
npx --yes [email protected] run --filter @t3tools/web test src/uiStateStore.test.tsnpx --yes [email protected] fmtnpx --yes [email protected] lint- exit 0, existing warnings onlynpx --yes [email protected] typecheck