Skip to content

Commit 7f8667e

Browse files
filip mertensbunsenstraat
authored andcommitted
fix remixd sorting
1 parent a739065 commit 7f8667e

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

libs/remix-ui/workspace/src/lib/components/file-explorer.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,13 @@ export const FileExplorer = (props: FileExplorerProps) => {
319319

320320
useEffect(() => {
321321
if(files[ROOT_PATH]){
322-
const children: FileType[] = files[ROOT_PATH] as any
323-
setChildrenKeys(fileKeySort(children))
322+
323+
try {
324+
const children: FileType[] = files[ROOT_PATH] as any
325+
setChildrenKeys(fileKeySort(children))
326+
} catch (error) {
327+
setChildrenKeys(Object.keys(files[ROOT_PATH]))
328+
}
324329
} else{
325330
setChildrenKeys([])
326331
}

libs/remix-ui/workspace/src/lib/components/file-render.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ export const FileRender = (props: RenderFileProps) => {
4141
}, [props.file])
4242

4343
useEffect(() => {
44-
45-
if(file.child){
46-
const children: FileType[] = file.child as any
47-
setChildrenKeys(fileKeySort(children))
44+
if (file.child) {
45+
try {
46+
const children: FileType[] = file.child as any
47+
setChildrenKeys(fileKeySort(children))
48+
} catch (e) {
49+
setChildrenKeys(Object.keys(file.child))
50+
}
4851
} else {
4952
setChildrenKeys([])
5053
}
51-
5254
}, [file.child, props.expandPath, props.file])
5355

5456
const labelClass =

0 commit comments

Comments
 (0)