Persist changed-files expansion state per thread#1858
Persist changed-files expansion state per thread#1858Marve10s wants to merge 4 commits 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)
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 |
apps/web/src/components/chat/MessagesTimeline.virtualization.browser.tsx
Show resolved
Hide resolved
The `?? {}` fallback treated a missing key in `right` as an empty
object, so two records with different outer keys but empty inner
values were incorrectly considered equal. Check `key in right`
before comparing inner records.
ApprovabilityVerdict: Approved This PR moves UI expansion state from local component state to the persisted store, following the exact same pattern already established for You can customize Macroscope's approvability policy. Learn more. |
What changed
MessagesTimelinecomponent state.uiStateStore, keyed by scoped thread id and turn id.Why
The changed-files tree reset to expanded whenever the thread view unmounted and mounted again. That happened because the expansion map lived inside
MessagesTimelineas local React state.Notes
MessagesTimeline.tsx, but for unrelated work.Validation
bun fmtbun lintbun typecheckbun run --cwd apps/web test --run src/uiStateStore.test.ts src/components/chat/MessagesTimeline.test.tsxNote
Persist changed-files expansion state per thread across sessions
threadChangedFilesExpandedByIdto the UI state store in uiStateStore.ts, tracking per-turn collapsed overrides per thread.false) entries are stored; expanded state is the default and is not persisted, minimizing localStorage usage.changedFilesExpandedByTurnIdandonSetChangedFilesExpandedprops.MessagesTimelineremoves its internal expansion state and becomes fully controlled by the caller.syncThreads) or their UI is cleared (clearThreadUi).Macroscope summarized 86a3158.
Note
Low Risk
Low risk UI-state change that mainly moves expand/collapse state from component-local state into persisted
uiStateStore; primary risk is incorrect keying/pruning causing unexpected expansion defaults across threads.Overview
Persists the per-turn Changed files expand/collapse state across chat navigation by moving it from
MessagesTimelinelocal state intouiStateStore, keyed by scoped thread id and turn id.Adds
threadChangedFilesExpandedByIdplussetThreadChangedFilesExpanded, persists the data tolocalStorage(storing only collapsedfalseoverrides), sanitizes it on load, and prunes it when threads are removed or cleared.Wires the new state through
ChatViewintoMessagesTimeline/virtualization harness and updates tests to include the new props.Reviewed by Cursor Bugbot for commit 86a3158. Bugbot is set up for automated code reviews on this repo. Configure here.