From e58f18d0a9ffd5a2f28c43c630e94667b07f909c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Szabo?= Date: Fri, 29 May 2026 23:24:22 -0300 Subject: [PATCH 1/3] Adding "atomic update" support --- src/file.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/file.js b/src/file.js index 0525076..bebb4d8 100644 --- a/src/file.js +++ b/src/file.js @@ -485,13 +485,17 @@ class File { this.detectResurrectionAfterDelay(); return; case 'rename': - this.setPath(eventPath); - this.subscribeToNativeChangeEvents(); - if (Grim.includeDeprecatedAPIs) { - this.emit('moved'); + if (eventPath !== this.path) { + this.setPath(eventPath); + this.subscribeToNativeChangeEvents(); + if (Grim.includeDeprecatedAPIs) { + this.emit('moved'); + } + this.emitter.emit('did-rename'); + return; } - this.emitter.emit('did-rename'); - return; + // Same event name - it's an atomic update + this.unsubscribeFromNativeChangeEvents(); case 'change': case 'resurrect': this.cachedContents = null; From 599cd88141dc443958bdbcad3982cf23c6f6a27f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Szabo?= Date: Fri, 29 May 2026 23:25:09 -0300 Subject: [PATCH 2/3] Fixing not watching after --- src/file.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/file.js b/src/file.js index bebb4d8..cebf6ea 100644 --- a/src/file.js +++ b/src/file.js @@ -496,6 +496,7 @@ class File { } // Same event name - it's an atomic update this.unsubscribeFromNativeChangeEvents(); + this.subscribeToNativeChangeEvents(); // because the inode changed case 'change': case 'resurrect': this.cachedContents = null; From 409680e901a1b121df300652a6245206f5ade32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Szabo?= Date: Fri, 29 May 2026 23:33:34 -0300 Subject: [PATCH 3/3] Fix comment --- src/file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file.js b/src/file.js index cebf6ea..e4aa216 100644 --- a/src/file.js +++ b/src/file.js @@ -494,7 +494,7 @@ class File { this.emitter.emit('did-rename'); return; } - // Same event name - it's an atomic update + // Same file name - it's an atomic update this.unsubscribeFromNativeChangeEvents(); this.subscribeToNativeChangeEvents(); // because the inode changed case 'change':