Et2Link: Wait for link title before we say update is complete

Overriding _getUpdateComplete() lets us wait for whatever conditions we want, so we can wait on the Promise from link_title()
This commit is contained in:
nathan 2023-06-02 09:04:34 -06:00
parent 2946316d0b
commit 572cc61315

View File

@ -154,6 +154,16 @@ export class Et2Link extends ExposeMixin<Et2Widget>(Et2Widget(LitElement)) imple
super.connectedCallback();
}
async _getUpdateComplete()
{
await super._getUpdateComplete();
if(this._titlePromise)
{
// Wait for the title to arrive before we say we're done
await this._titlePromise;
}
}
/**
* Build a thumbnail for the link
* @param link
@ -369,7 +379,10 @@ export class Et2Link extends ExposeMixin<Et2Widget>(Et2Widget(LitElement)) imple
let url = _data.download_url;
// NEED an absolute URL
if (url[0] == '/') url = egw.link(url);
if(url[0] == '/')
{
url = this.egw().link(url);
}
// egw.link adds the webserver, but that might not be an absolute URL - try again
if (url[0] == '/') url = window.location.origin + url;