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