mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 11:01:37 -05:00
check for changeRef not destroyed before detecting changes (#4385)
This commit is contained in:
@@ -171,7 +171,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
}
|
}
|
||||||
this._model.activeCell = cell;
|
this._model.activeCell = cell;
|
||||||
this._model.activeCell.active = true;
|
this._model.activeCell.active = true;
|
||||||
this._changeRef.detectChanges();
|
this.detectChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
this.model.activeCell.active = false;
|
this.model.activeCell.active = false;
|
||||||
this.model.activeCell = undefined;
|
this.model.activeCell = undefined;
|
||||||
}
|
}
|
||||||
this._changeRef.detectChanges();
|
this.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add cell based on cell type
|
// Add cell based on cell type
|
||||||
@@ -195,7 +195,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
cell.trustedMode = isTrusted;
|
cell.trustedMode = isTrusted;
|
||||||
});
|
});
|
||||||
//TODO: Handle dirty for trust?
|
//TODO: Handle dirty for trust?
|
||||||
this._changeRef.detectChanges();
|
this.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
public onKeyDown(event) {
|
public onKeyDown(event) {
|
||||||
@@ -235,7 +235,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
|
|
||||||
private setLoading(isLoading: boolean): void {
|
private setLoading(isLoading: boolean): void {
|
||||||
this.isLoading = isLoading;
|
this.isLoading = isLoading;
|
||||||
this._changeRef.detectChanges();
|
this.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async loadModel(): Promise<void> {
|
private async loadModel(): Promise<void> {
|
||||||
@@ -269,7 +269,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
this.updateToolbarComponents(this._model.trustedMode);
|
this.updateToolbarComponents(this._model.trustedMode);
|
||||||
this._modelRegisteredDeferred.resolve(this._model);
|
this._modelRegisteredDeferred.resolve(this._model);
|
||||||
model.backgroundStartSession();
|
model.backgroundStartSession();
|
||||||
this._changeRef.detectChanges();
|
this.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async awaitNonDefaultProvider(): Promise<void> {
|
private async awaitNonDefaultProvider(): Promise<void> {
|
||||||
@@ -322,7 +322,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
|
|
||||||
private handleContentChanged(change: NotebookContentChange) {
|
private handleContentChanged(change: NotebookContentChange) {
|
||||||
// Note: for now we just need to set dirty state and refresh the UI.
|
// Note: for now we just need to set dirty state and refresh the UI.
|
||||||
this._changeRef.detectChanges();
|
this.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleProviderIdChanged(providerId: string) {
|
private handleProviderIdChanged(providerId: string) {
|
||||||
@@ -497,6 +497,12 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
this.addPrimaryContributedActions(primary);
|
this.addPrimaryContributedActions(primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private detectChanges(): void {
|
||||||
|
if (!(this._changeRef['destroyed'])) {
|
||||||
|
this._changeRef.detectChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private addPrimaryContributedActions(primary: IAction[]) {
|
private addPrimaryContributedActions(primary: IAction[]) {
|
||||||
for (let action of primary) {
|
for (let action of primary) {
|
||||||
// Need to ensure that we don't add the same action multiple times
|
// Need to ensure that we don't add the same action multiple times
|
||||||
|
|||||||
Reference in New Issue
Block a user