Skip to content

Commit

Permalink
Fixes to reverting notebooks (microsoft#12410)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Jun 18, 2020
1 parent 2003e01 commit ae8903d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Expand Up @@ -632,9 +632,12 @@ export class NativeEditorStorage implements INotebookStorage {
await this.fileSystem.writeFile(filePath, contents);
}
} else {
await this.fileSystem
.deleteFile(filePath)
.catch((ex) => traceError('Failed to delete hotExit file. Possible it does not exist', ex));
await this.fileSystem.deleteFile(filePath).catch((ex) => {
// No need to log error if file doesn't exist.
if (!isFileNotFoundError(ex)) {
traceError('Failed to delete hotExit file. Possible it does not exist', ex);
}
});
}
}
} catch (exc) {
Expand Down
5 changes: 4 additions & 1 deletion src/client/datascience/notebook/contentProvider.ts
Expand Up @@ -65,7 +65,10 @@ export class NotebookContentProvider implements VSCodeNotebookContentProvider {
metadata: { cellEditable: false, editable: false, runnable: false }
};
}
const model = await this.notebookStorage.load(uri, undefined, !openContext.backupId);
// If there's no backup id, then skip loading dirty contents.
const model = await (openContext.backupId
? this.notebookStorage.load(uri, undefined, openContext.backupId)
: this.notebookStorage.load(uri, undefined, true));
// If experiment is not enabled, then this method was invoked as user opted to try and open using the new API.
if (!this.useVSCodeNotebookEditorApi) {
updateModelForUseWithVSCodeNotebook(model);
Expand Down

0 comments on commit ae8903d

Please sign in to comment.