Desktop: Fixes #16758: Stop external editing when a note gets locked on another device (#16762)

This commit is contained in:
Keshav authored and GitHub committed 2026-10-11 16:07:47 +01:00
1 parent 052583a8fb
commit 3f7dde0045
3 files changed
+42 -5

No files matched your search

+3 -2
View File
@@ -300,10 +300,11 @@ export default class ExternalEditWatcher {
this.logger().info(`ExternalEditWatcher: Started watching ${filePath}`);
}
public async stopWatching(noteId: string) {
// Without a flush, a pending change finds the file removed below and is dropped.
public async stopWatching(noteId: string, flushPendingChanges = true) {
if (!noteId) return;
await this.changeEventQueue_.processAllNow();
if (flushPendingChanges) await this.changeEventQueue_.processAllNow();
const filePath = this.noteIdToFilePath_(noteId);
if (this.watcher_) this.watcher_.unwatch(filePath);