From 4cdbb02de2d6cd7027ea197df8d295545af6c995 Mon Sep 17 00:00:00 2001 From: wukko Date: Mon, 16 Dec 2024 00:25:45 +0600 Subject: [PATCH] =?UTF-8?q?web/SupportedServices:=20speed=20up=20the=20sec?= =?UTF-8?q?ondary=20expand=20by=20~200=CE=BCs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/save/SupportedServices.svelte | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/web/src/components/save/SupportedServices.svelte b/web/src/components/save/SupportedServices.svelte index d3077a2a..6dcb9244 100644 --- a/web/src/components/save/SupportedServices.svelte +++ b/web/src/components/save/SupportedServices.svelte @@ -23,20 +23,26 @@ } }; + const popoverAction = async () => { + expanded = !expanded; + if (expanded && services.length === 0) { + await loadInfo(); + } + if (expanded) { + popover.focus(); + } + } + const showPopover = async () => { - const timeout = renderPopover ? 0 : 10; + const timeout = !renderPopover; renderPopover = true; // 10ms delay to let the popover render for the first time - setTimeout(async () => { - expanded = !expanded; - if (expanded && services.length === 0) { - await loadInfo(); - } - if (expanded) { - popover.focus(); - } - }, timeout); + if (timeout) { + setTimeout(popoverAction, 10); + } else { + await popoverAction(); + } };