fix(preload): saveFile IPC payload was being shadowed by stray channel arg

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
This commit is contained in:
2026-09-30 21:51:13 +05:30
parent 8fb61130f3
commit dadfe52870
+1 -2
View File
@@ -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),
},