From c0a0b52fbb58e848c76136eafa21a66816fcfd9d Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 29 Sep 2021 21:36:44 +0200 Subject: [PATCH] web/elements: fix initialLoad not being done when viewportCheck was disabled closes #1497 Signed-off-by: Jens Langhammer --- web/src/elements/forms/ModelForm.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/web/src/elements/forms/ModelForm.ts b/web/src/elements/forms/ModelForm.ts index 52cd35808..8afa0063b 100644 --- a/web/src/elements/forms/ModelForm.ts +++ b/web/src/elements/forms/ModelForm.ts @@ -48,10 +48,16 @@ export abstract class ModelForm extends Form } render(): TemplateResult { - // 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.instancePk = this._instancePk; - this._initialLoad = true; + if (this._instancePk) { + if ( + // if we're in viewport now and haven't loaded AND have a PK set, load now + (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(); }