Don't trigger buffer:change event when file is removed

This commit is contained in:
Jonatan Heyman 2024-10-28 13:56:27 +01:00
parent cf2be9723d
commit 40771b8fb5

View File

@ -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)
}
}