@@ -34,6 +34,7 @@ import { useProjects, useThreadShells } from "../../state/entities";
3434import { mobilePreferencesAtom } from "../../state/preferences" ;
3535import { useThreadSearch } from "../../state/queries" ;
3636import { useThreadListV2Enabled } from "./use-thread-list-v2-enabled" ;
37+ import { useThreadListV2ShelfPreferences } from "./use-thread-list-v2-shelf-preferences" ;
3738import { environmentServerConfigsAtom } from "../../state/server" ;
3839import { usePendingNewTasks } from "../../state/use-pending-new-tasks" ;
3940import { useWorkspaceState } from "../../state/workspace" ;
@@ -460,10 +461,13 @@ function ThreadNavigationSidebarPane(
460461 ( ) => setSettledVisibleCount ( ( count ) => count + THREAD_LIST_V2_SETTLED_PAGE_COUNT ) ,
461462 [ ] ,
462463 ) ;
463- const [ snoozedShelfExpanded , setSnoozedShelfExpanded ] = useState ( false ) ;
464- const toggleSnoozedShelf = useCallback ( ( ) => setSnoozedShelfExpanded ( ( value ) => ! value ) , [ ] ) ;
465- const [ settledShelfExpanded , setSettledShelfExpanded ] = useState ( true ) ;
466- const toggleSettledShelf = useCallback ( ( ) => setSettledShelfExpanded ( ( value ) => ! value ) , [ ] ) ;
464+ const {
465+ loaded : shelfPreferencesLoaded ,
466+ settledShelfExpanded,
467+ snoozedShelfExpanded,
468+ toggleSettledShelf,
469+ toggleSnoozedShelf,
470+ } = useThreadListV2ShelfPreferences ( ) ;
467471 // now ticks per minute so the inactivity auto-settle boundary is actually
468472 // crossed while the pane stays open; without a clock dependency the
469473 // partition memoizes a frozen "now".
@@ -1008,6 +1012,7 @@ function ThreadNavigationSidebarPane(
10081012 return (
10091013 < ThreadListV2SnoozedShelfHeader
10101014 count = { item . count }
1015+ disabled = { ! shelfPreferencesLoaded }
10111016 expanded = { item . expanded }
10121017 onToggle = { toggleSnoozedShelf }
10131018 pane = "sidebar"
@@ -1017,6 +1022,7 @@ function ThreadNavigationSidebarPane(
10171022 return (
10181023 < ThreadListV2SettledShelfHeader
10191024 count = { item . count }
1025+ disabled = { ! shelfPreferencesLoaded }
10201026 expanded = { item . expanded }
10211027 onToggle = { toggleSettledShelf }
10221028 pane = "sidebar"
@@ -1140,6 +1146,7 @@ function ThreadNavigationSidebarPane(
11401146 props . width ,
11411147 savedConnectionsById ,
11421148 serverConfigs ,
1149+ shelfPreferencesLoaded ,
11431150 threadSearchMatchByKey ,
11441151 titleRegenerationEnvironmentIds ,
11451152 settleThread ,
0 commit comments