Skip to content

Commit

Permalink
Don't trigger buffer:change event when file is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
heyman committed Oct 28, 2024
1 parent cf2be97 commit 40771b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion electron/main/file-library.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 40771b8

Please sign in to comment.