fix(mobile): persist thread shelf collapse state - #5152
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 ccd4313 Simple UI state persistence change that moves shelf collapse state from in-memory to persisted storage. Uses existing preferences infrastructure, includes proper sanitization and tests, and is self-contained with no broader runtime impact. You can customize Macroscope's approvability policy. Learn more. |
What Changed
Why
#5056 made the mobile Settled shelf collapsible, but both mobile shelves still reset whenever the app restarts. This brings mobile in line with the persistence fix in #5136 without adding another storage mechanism.
UI Changes
No visual changes. The existing shelf layout and interactions are unchanged; only the chosen expansion state now survives a restart.
Verification
vp test run apps/mobile/src/lib/storage.test.ts apps/mobile/src/features/threads/threadListV2.test.ts(47 tests)vp run --filter @t3tools/mobile typecheckgit diff --checkChecklist
Model: GPT-5.6 Sol | Harness: Codex in T3 Code
Note
Low Risk
Device-local UI preference persistence with boolean defaults and sanitization; no auth, sync, or thread lifecycle changes.
Overview
Thread List v2 Settled and Snoozed shelf expand/collapse now survives app restarts on mobile. Home and the iPad sidebar no longer keep separate in-memory shelf state; both use a shared hook that reads and writes the existing device mobile preferences store.
New preference keys
threadListV2SettledShelfExpandedandthreadListV2SnoozedShelfExpandedkeep first-run behavior: Settled expanded unless explicitlyfalse, Snoozed collapsed unless explicitlytrue. Shelf header toggles stay disabled until preferences load, and invalid stored types are dropped during parse (covered by storage tests).Reviewed by Cursor Bugbot for commit ccd4313. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Persist thread shelf collapse state across sessions in mobile
useThreadListV2ShelfPreferenceshook inuse-thread-list-v2-shelf-preferences.tsthat reads and writes snoozed/settled shelf expansion state tomobilePreferencesAtom, replacing local component state inHomeScreenandThreadNavigationSidebarPane.false) and settled shelf defaults to expanded (true) when no persisted value exists.threadListV2SettledShelfExpandedandthreadListV2SnoozedShelfExpandedfields to thePreferencesinterface with sanitization that drops non-boolean values.disabledprop and are disabled until preferences finish loading to prevent toggling before state is known.Macroscope summarized ccd4313.