From 50f4f625759e2c6b06c14a0c39eb4cf4a01940a2 Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Thu, 11 Jun 2026 07:49:42 +0530 Subject: [PATCH] fix: handle list-directory return shape {entries} in openFolder/loadChildren The main process list-directory handler returns {path, entries} but the file store was calling .map() directly on result.data. Since arrays have a .entries iterator method, the nullish coalescing fallback didn't work. Now properly extracts the entries array with Array.isArray check. --- src/renderer/stores/file-store.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; }); });