From 40771b8fb530b7e548e1557a1d185972df41f969 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Mon, 28 Oct 2024 13:56:27 +0100 Subject: [PATCH] Don't trigger buffer:change event when file is removed --- electron/main/file-library.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/electron/main/file-library.js b/electron/main/file-library.js index b387c26..7dc6143 100644 --- a/electron/main/file-library.js +++ b/electron/main/file-library.js @@ -164,7 +164,8 @@ export class FileLibrary { for (const [path, buffer] of Object.entries(this.files)) { if (changedPath === basename(path)) { const content = await buffer.read() - if (buffer._lastSavedContent !== content) { + // if the file was removed (e.g. during a atomic save) the content will be undefined + if (content !== undefined && buffer._lastSavedContent !== content) { win.webContents.send("buffer:change", path, content) } }