web/elements: fix initialLoad not being done when viewportCheck was disabled

closes #1497

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-29 21:36:44 +02:00
parent 8359f0bfb3
commit f723fdd551
1 changed files with 10 additions and 4 deletions

View File

@ -48,11 +48,17 @@ export abstract class ModelForm<T, PKT extends string | number> extends Form<T>
}
render(): TemplateResult {
if (this._instancePk) {
if (
// if we're in viewport now and haven't loaded AND have a PK set, load now
if (this.isInViewport && !this._initialLoad && this._instancePk) {
(this.isInViewport && !this._initialLoad) ||
// Or if we don't check for viewport in some cases
!this.viewportCheck
) {
this.instancePk = this._instancePk;
this._initialLoad = true;
}
}
return super.render();
}
}