fix(web): preserve closed plan panel state - #5536
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 |
|
If I delete tests it's an XS 😅 |
ApprovabilityVerdict: Approved 87ead15 This is a well-structured UI bug fix that extracts sidebar auto-open logic into pure, testable functions with comprehensive unit tests. The change is self-contained to plan panel state management with no broader runtime or security implications. You can customize Macroscope's approvability policy. Learn more. |
Problem
Reopening a thread could auto-open its Plan or Tasks panel even when the user had previously closed it. Existing steps loaded during thread restoration were treated like newly arrived plan updates, overriding the thread's persisted right-panel state.
This made returning to plan-bearing threads disruptive, especially while a turn was still running and continuing to publish task status updates.
Root cause
The auto-open effect only compared the active plan's turn with the latest turn. On navigation or hydration, the restored plan still belonged to that latest turn, so the effect could not distinguish an existing snapshot from a new update.
Fix
The same logic covers both Plan and Tasks because they share the plan right-panel surface.
Testing
pnpm exec vp test run apps/web/src/components/ChatView.logic.test.ts apps/web/src/session-logic.test.ts apps/web/src/rightPanelStore.test.ts— 142 tests passedpnpm --filter @t3tools/web typecheckvp lintfor the five changed filesvp fmt --checkfor the five changed filesgit diff --check origin/main...HEADBrowser QA was not run. The behavior is covered by focused state-transition tests.
Reviewed with Claude Opus via
claude -p.Implemented with GPT-5.6 Codex via T3 Code.
Note
Preserve closed plan panel state across thread activation and restoration
resolvePlanSidebarAutoOpen,resolvePlanSidebarRestoration, andresolvePlanSidebarTurnKeyutilities in ChatView.logic.ts to centralize plan sidebar open/close decisions.plansurface is preserved on thread restoration; dismissal is seeded for that turn so the panel does not re-open.ActivePlanStatein session-logic.ts gains anupdateIdfield, used to detect whether a plan update is new since the last observed baseline.'wait'during thread-detail loading,'preserve'when restoring prior state, and'none'in cases such as dismissed turns or stale plans, replacing the previous unconditional open behavior.Macroscope summarized 87ead15.