From 5ec58a723eee994a3bd7bf2c16f4952e63dd99d7 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 21 Jul 2019 09:54:12 -0700 Subject: [PATCH] properly store width (#3400) --- .../config-flow/step-flow-pick-handler.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/dialogs/config-flow/step-flow-pick-handler.ts b/src/dialogs/config-flow/step-flow-pick-handler.ts index 3305c258d7..7edc2b1f35 100644 --- a/src/dialogs/config-flow/step-flow-pick-handler.ts +++ b/src/dialogs/config-flow/step-flow-pick-handler.ts @@ -80,13 +80,19 @@ class StepFlowPickHandler extends LitElement { `; } + protected updated(changedProps) { + super.updated(changedProps); + // Store the width so that when we search, box doesn't jump + if (!this._width) { + const width = this.shadowRoot!.querySelector("div")!.clientWidth; + if (width) { + this._width = width; + } + } + } + private async _filterChanged(e) { this.filter = e.detail.value; - - // Store the width so that when we search, box doesn't jump - if (this._width === undefined) { - this._width = this.shadowRoot!.querySelector("div")!.clientWidth; - } } private async _handlerPicked(ev) {