From 27cbd532538e9498292bde921df14ab3633d870e Mon Sep 17 00:00:00 2001 From: Kevin Cunnane Date: Tue, 18 Jun 2019 17:38:20 -0700 Subject: [PATCH] Fix notebook dirty state after save (#6096) Was getting a content changed loop in the events Fix is to ignore save events from the input since it sends them --- src/sql/workbench/parts/notebook/notebookInput.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sql/workbench/parts/notebook/notebookInput.ts b/src/sql/workbench/parts/notebook/notebookInput.ts index 09dbd4fc42..4a4fff93e1 100644 --- a/src/sql/workbench/parts/notebook/notebookInput.ts +++ b/src/sql/workbench/parts/notebook/notebookInput.ts @@ -93,6 +93,11 @@ export class NotebookEditorModel extends EditorModel { } public updateModel(contentChange?: NotebookContentChange): void { + if (contentChange && contentChange.changeType === NotebookChangeType.Saved) { + // We send the saved events out, so ignore. Otherwise we double-count this as a change + // and cause the text to be reapplied + return; + } if (contentChange && contentChange.changeType === NotebookChangeType.TrustChanged) { // This is a serializable change (in that we permanently cache trusted state, but // ironically isn't cached in the JSON contents since trust doesn't persist across machines. @@ -115,7 +120,7 @@ export class NotebookEditorModel extends EditorModel { } } - private sendNotebookSerializationStateChange() { + private sendNotebookSerializationStateChange(): void { let notebookModel = this.getNotebookModel(); if (notebookModel) { this.notebookService.serializeNotebookStateChange(this.notebookUri, NotebookChangeType.Saved);