fix null reference issue (#22113)

* fix null reference issue

* move opendialog call out of promise.
This commit is contained in:
Alan Ren
2023-03-02 14:44:10 -08:00
committed by GitHub
parent da92875fea
commit 9b6018a21e

View File

@@ -114,8 +114,10 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
public async open(): Promise<void> { public async open(): Promise<void> {
try { try {
const initializeViewPromise = new Promise<void>((async resolve => {
await this.dialogObject.registerContent(async view => { await this.dialogObject.registerContent(async view => {
this._modelView = view; this._modelView = view;
resolve();
this._formContainer = this.createFormContainer([]); this._formContainer = this.createFormContainer([]);
this._loadingComponent = view.modelBuilder.loadingComponent().withItem(this._formContainer).withProps({ this._loadingComponent = view.modelBuilder.loadingComponent().withItem(this._formContainer).withProps({
loading: true, loading: true,
@@ -126,10 +128,12 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
height: "100%" height: "100%"
} }
}).component(); }).component();
return view.initializeModel(this._loadingComponent); await view.initializeModel(this._loadingComponent);
}); });
}));
azdata.window.openDialog(this.dialogObject); azdata.window.openDialog(this.dialogObject);
this._viewInfo = await this.initializeData(); this._viewInfo = await this.initializeData();
await initializeViewPromise;
await this.initializeUI(); await this.initializeUI();
this._originalObjectInfo = deepClone(this.objectInfo); this._originalObjectInfo = deepClone(this.objectInfo);
const typeDisplayName = getNodeTypeDisplayName(this.objectType); const typeDisplayName = getNodeTypeDisplayName(this.objectType);