File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
quartz/components/scripts Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ async function setupExplorer(currentSlug: FullSlug) {
161161 // Get folder state from local storage
162162 const storageTree = localStorage . getItem ( "fileTree" )
163163 const serializedExplorerState = storageTree && opts . useSavedState ? JSON . parse ( storageTree ) : [ ]
164- const oldIndex = new Map (
164+ const oldIndex = new Map < string , boolean > (
165165 serializedExplorerState . map ( ( entry : FolderState ) => [ entry . path , entry . collapsed ] ) ,
166166 )
167167
@@ -186,10 +186,14 @@ async function setupExplorer(currentSlug: FullSlug) {
186186
187187 // Get folder paths for state management
188188 const folderPaths = trie . getFolderPaths ( )
189- currentExplorerState = folderPaths . map ( ( path ) => ( {
190- path,
191- collapsed : oldIndex . get ( path ) === true ,
192- } ) )
189+ currentExplorerState = folderPaths . map ( ( path ) => {
190+ const previousState = oldIndex . get ( path )
191+ return {
192+ path,
193+ collapsed :
194+ previousState === undefined ? opts . folderDefaultState === "collapsed" : previousState ,
195+ }
196+ } )
193197
194198 const explorerUl = explorer . querySelector ( ".explorer-ul" )
195199 if ( ! explorerUl ) continue
You can’t perform that action at this time.
0 commit comments