fix remixd sorting

pull/4098/head
filip mertens 1 year ago committed by bunsenstraat
parent a739065c2b
commit 7f8667ef20
  1. 9
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  2. 12
      libs/remix-ui/workspace/src/lib/components/file-render.tsx

@ -319,8 +319,13 @@ export const FileExplorer = (props: FileExplorerProps) => {
useEffect(() => {
if(files[ROOT_PATH]){
const children: FileType[] = files[ROOT_PATH] as any
setChildrenKeys(fileKeySort(children))
try {
const children: FileType[] = files[ROOT_PATH] as any
setChildrenKeys(fileKeySort(children))
} catch (error) {
setChildrenKeys(Object.keys(files[ROOT_PATH]))
}
} else{
setChildrenKeys([])
}

@ -41,14 +41,16 @@ export const FileRender = (props: RenderFileProps) => {
}, [props.file])
useEffect(() => {
if(file.child){
const children: FileType[] = file.child as any
setChildrenKeys(fileKeySort(children))
if (file.child) {
try {
const children: FileType[] = file.child as any
setChildrenKeys(fileKeySort(children))
} catch (e) {
setChildrenKeys(Object.keys(file.child))
}
} else {
setChildrenKeys([])
}
}, [file.child, props.expandPath, props.file])
const labelClass =

Loading…
Cancel
Save