Skip to content

Commit 77c0347

Browse files
committed
Improve error handling in DeepnoteFileChangeWatcher to prevent stale mtime conflicts during workspace saves
1 parent 9b5c107 commit 77c0347

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/notebooks/deepnote/deepnoteFileChangeWatcher.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,15 @@ export class DeepnoteFileChangeWatcher implements IExtensionSyncActivationServic
359359
} catch (writeError) {
360360
this.consumeSelfWrite(fileUri);
361361
logger.warn(`[FileChangeWatcher] Failed to write synced file: ${fileUri.path}`, writeError);
362+
363+
// Bail out — without a successful write, workspace.save() would hit
364+
// the stale mtime and show a "content is newer" conflict dialog.
365+
// The notebook stays dirty but cells are already up-to-date from applyEdit.
366+
return;
362367
}
363368

364-
// Now save — VS Code serializes (same bytes), sees the mtime is from our
365-
// recent write (which its internal watcher has picked up), and writes
366-
// successfully without a "content is newer" conflict.
369+
// Save to clear dirty state. VS Code serializes (same bytes) and sees the
370+
// mtime from our recent write, so no "content is newer" conflict.
367371
this.markSelfWrite(fileUri);
368372
try {
369373
await workspace.save(notebook.uri);

0 commit comments

Comments
 (0)