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 3a476dcbd6
commit 846852ca22

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
@ -371,7 +381,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;