File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 11import { DirectoryEntry } from '@/features/instance/operations/queries/getComponents' ;
2- import { useState } from 'react' ;
2+ import { useSessionStorage } from '@/hooks/useSessionStorage' ;
3+ import { useParams } from '@tanstack/react-router' ;
4+ import { File } from './File' ;
35import { calculateIconForDirectoryEntry } from './lib/calculateIconForDirectoryEntry' ;
46import { directorySortComparator } from './lib/directorySortComparator' ;
57import { parseFileExtension } from './lib/parseFileExtension' ;
6- import { File } from './File' ;
78
89export function Folder ( { directoryEntry, depth, pkg } : {
910 readonly directoryEntry : DirectoryEntry ;
1011 readonly depth : number ;
1112 readonly pkg ?: string ;
1213} ) {
13- const [ open , setOpen ] = useState ( depth <= 1 && ! directoryEntry . package ) ;
14+ const { instanceId, clusterId } = useParams ( { strict : false } ) ;
15+ const [ open , setOpen ] = useSessionStorage ( `FolderOpened/${ instanceId ?? clusterId } /${ directoryEntry . key } ` as 'FolderOpened/{instanceId}/{key}' , depth <= 1 && ! directoryEntry . package ) ;
1416
1517 const entries = [ ...( directoryEntry . entries || [ ] ) ] . sort ( directorySortComparator ) ;
1618 const fileExtension = parseFileExtension ( directoryEntry . name ) ;
You can’t perform that action at this time.
0 commit comments