From b1f6a89e169263d739491563e9df87b4cc6693c4 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Tue, 3 Jan 2023 10:47:32 +0100 Subject: [PATCH] Fixed use directive --- src/components/InputSearch.svelte | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/InputSearch.svelte b/src/components/InputSearch.svelte index ff6c95f..e8a5387 100644 --- a/src/components/InputSearch.svelte +++ b/src/components/InputSearch.svelte @@ -19,12 +19,15 @@ } } - async function selectInput() { - await tick() - elInput.focus() - await tick() - elInput.select() - await tick() + function selectInput(_?: HTMLElement): void { + tick() + .then(() => { + elInput.focus() + return tick() + }) + .then(() => { + elInput.select() + }) } const debouncedOnInput = debounce(() => {