diff --git a/src/renderer/stores/file-store.ts b/src/renderer/stores/file-store.ts index b44c530..1bdf3ab 100644 --- a/src/renderer/stores/file-store.ts +++ b/src/renderer/stores/file-store.ts @@ -86,7 +86,9 @@ export const useFileStore = create()( return; } - const children: FileNode[] = result.data!.map(entryToNode); + const raw: any = result.data!; + const entries: any[] = Array.isArray(raw) ? raw : raw.entries; + const children: FileNode[] = entries.map(entryToNode); set((s) => { s.tree = { @@ -117,7 +119,9 @@ export const useFileStore = create()( set((s) => { updateNode(s.tree!, dirPath, (node) => { - node.children = result.data!.map(entryToNode); + const raw: any = result.data!; + const items: any[] = Array.isArray(raw) ? raw : raw.entries; + node.children = items.map(entryToNode); node.loaded = true; }); });