Fix vfsWidget sometimes gives "TypeError: Cannot read properties of null (reading 'get_value')"

It was trying to access template widgets before they had loaded.  Fixed to wait until load is done.
This commit is contained in:
nathan 2023-12-13 11:09:22 -07:00
parent 9c4ae50735
commit 4856e97010

View File

@ -1274,13 +1274,14 @@ export class et2_vfsSelect extends et2_inputWidget
});
document.body.appendChild(<HTMLElement><unknown>this.dialog);
this.dialog.addEventListener('open', function(e)
// Wait for dialog to finish loading
this.dialog.updateComplete.then(() =>
{
app.vfsSelectUI.et2 = self.dialog.template.widgetContainer;
app.vfsSelectUI.vfsSelectWidget = self;
app.vfsSelectUI.et2_ready(app.vfsSelectUI.et2, 'api.vfsSelectUI');
app.vfsSelectUI.et2.getInstanceManager().app_obj['vfsSelectUI'] = app.vfsSelectUI;
});
})
this.dialog.addEventListener("close", () =>
{
self.dialog = undefined;