@@ -64,7 +64,7 @@ import { useServer } from "@/context/server"
6464
6565export default function Layout ( props : ParentProps ) {
6666 const [ store , setStore , , ready ] = persisted (
67- Persist . global ( "layout" , [ "layout.v6 " ] ) ,
67+ Persist . global ( "layout.page " , [ "layout.page.v1 " ] ) ,
6868 createStore ( {
6969 lastSession : { } as { [ directory : string ] : string } ,
7070 activeProject : undefined as string | undefined ,
@@ -74,6 +74,9 @@ export default function Layout(props: ParentProps) {
7474 } ) ,
7575 )
7676
77+ const pageReady = createMemo ( ( ) => ready ( ) )
78+ const layoutReady = createMemo ( ( ) => layout . ready ( ) )
79+
7780 let scrollContainerRef : HTMLDivElement | undefined
7881 const xlQuery = window . matchMedia ( "(min-width: 1280px)" )
7982 const [ isLargeViewport , setIsLargeViewport ] = createSignal ( xlQuery . matches )
@@ -293,7 +296,8 @@ export default function Layout(props: ParentProps) {
293296 } )
294297
295298 createEffect ( ( ) => {
296- if ( ! ready ( ) ) return
299+ if ( ! pageReady ( ) ) return
300+ if ( ! layoutReady ( ) ) return
297301 const project = currentProject ( )
298302 if ( ! project ) return
299303
@@ -318,6 +322,16 @@ export default function Layout(props: ParentProps) {
318322 }
319323 } )
320324
325+ createEffect ( ( ) => {
326+ if ( ! pageReady ( ) ) return
327+ if ( ! layoutReady ( ) ) return
328+ for ( const [ directory , expanded ] of Object . entries ( store . workspaceExpanded ) ) {
329+ if ( layout . sidebar . workspaces ( directory ) ( ) ) continue
330+ if ( ! expanded ) continue
331+ setStore ( "workspaceExpanded" , directory , false )
332+ }
333+ } )
334+
321335 const currentSessions = createMemo ( ( ) => {
322336 const project = currentProject ( )
323337 if ( ! project ) return [ ] as Session [ ]
@@ -708,6 +722,7 @@ export default function Layout(props: ParentProps) {
708722 }
709723
710724 createEffect ( ( ) => {
725+ if ( ! pageReady ( ) ) return
711726 if ( ! params . dir || ! params . id ) return
712727 const directory = base64Decode ( params . dir )
713728 const id = params . id
0 commit comments