web/SupportedServices: speed up the secondary expand by ~200μs

This commit is contained in:
wukko 2024-12-16 00:25:45 +06:00
parent 2e4b76de6e
commit 4cdbb02de2
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -23,12 +23,7 @@
} }
}; };
const showPopover = async () => { const popoverAction = async () => {
const timeout = renderPopover ? 0 : 10;
renderPopover = true;
// 10ms delay to let the popover render for the first time
setTimeout(async () => {
expanded = !expanded; expanded = !expanded;
if (expanded && services.length === 0) { if (expanded && services.length === 0) {
await loadInfo(); await loadInfo();
@ -36,7 +31,18 @@
if (expanded) { if (expanded) {
popover.focus(); popover.focus();
} }
}, timeout); }
const showPopover = async () => {
const timeout = !renderPopover;
renderPopover = true;
// 10ms delay to let the popover render for the first time
if (timeout) {
setTimeout(popoverAction, 10);
} else {
await popoverAction();
}
}; };
</script> </script>