The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(explorer): properly respect folderDefaultState (closes #1827)

+9 -5
+9 -5
quartz/components/scripts/explorer.inline.ts
··· 161 161 // Get folder state from local storage 162 162 const storageTree = localStorage.getItem("fileTree") 163 163 const serializedExplorerState = storageTree && opts.useSavedState ? JSON.parse(storageTree) : [] 164 - const oldIndex = new Map( 164 + const oldIndex = new Map<string, boolean>( 165 165 serializedExplorerState.map((entry: FolderState) => [entry.path, entry.collapsed]), 166 166 ) 167 167 ··· 186 186 187 187 // Get folder paths for state management 188 188 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 + }) 193 197 194 198 const explorerUl = explorer.querySelector(".explorer-ul") 195 199 if (!explorerUl) continue