fix(git): git-status IPC returns a flat array, not wrapped object

GitOperations.getStatus returns { files: [...] } but the renderer's
ipc.file.gitStatus type declares Array<...> and calls result.data.map().
The mismatch made GitStatusPanel.tsx throw 'n.map is not a function'
on mount, which blanked the entire React tree.

Unwrap result.files in the IPC handler so it returns the array the
renderer expects. Add tests covering the success, empty, and non-git
branches so this regression cannot recur.

Refs: blank-screen-on-md-open
This commit is contained in:
2026-07-23 09:34:57 +05:30
parent ec3d53ea7e
commit 772a791d9a
2 changed files with 74 additions and 1 deletions
+2 -1
View File
@@ -8,7 +8,8 @@ function register(currentFileRef) {
const dir =
rootPath ||
(currentFileRef.current ? require('path').dirname(currentFileRef.current) : process.cwd());
return GitOperations.getStatus(dir);
const result = GitOperations.getStatus(dir);
return Array.isArray(result?.files) ? result.files : [];
});
ipcMain.handle('git-stage', async (_event, { rootPath, files }) => {