From dadfe528700ef822233af969b857968cb549f9fd Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Wed, 30 Sep 2026 21:51:13 +0530 Subject: [PATCH] fix(preload): saveFile IPC payload was being shadowed by stray channel arg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C9 (22bc4dc) introduced a malformed edit when wiring openFile. The saveFile arrow got a stray 'open-text-file-dialog' string between the channel and payload, so the ipcMain handler destructured the string (both fields undefined) instead of { content, defaultName }. saveFile silently saved with no content and no default name — the Save to File button worked through the dialog fallback but wrote whatever was in the buffer. Fix: drop the stray arg, restore the single-line invoke with the payload object. openFile stays on its own line below. format:check is now clean. Discovered during the v4.13.0 release rebuild when prettier wanted to collapse the malformed multi-line into one — the malformed shape itself was the bug, not the formatting. Amit Haridas --- src/preload.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/preload.js b/src/preload.js index be333ff..011da45 100644 --- a/src/preload.js +++ b/src/preload.js @@ -567,8 +567,7 @@ contextBridge.exposeInMainWorld('electronAPI', { readFile: (p) => ipcRenderer.invoke('read-text-file', p), writeFile: (p, content) => ipcRenderer.invoke('write-text-file', { path: p, content }), saveFile: (content, defaultName) => - ipcRenderer.invoke('save-text-file', - 'open-text-file-dialog', { content, defaultName }), + ipcRenderer.invoke('save-text-file', { content, defaultName }), openFile: () => ipcRenderer.invoke('open-text-file-dialog'), insertAtCursor: (text) => ipcRenderer.send('insert-content', text), },