mirror of
https://github.com/wukko/cobalt.git
synced 2025-01-22 10:46:19 +01:00
web/SupportedServices: speed up the secondary expand by ~200μs
This commit is contained in:
parent
2e4b76de6e
commit
4cdbb02de2
1 changed files with 16 additions and 10 deletions
|
@ -23,12 +23,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
const showPopover = async () => {
|
||||
const timeout = renderPopover ? 0 : 10;
|
||||
renderPopover = true;
|
||||
|
||||
// 10ms delay to let the popover render for the first time
|
||||
setTimeout(async () => {
|
||||
const popoverAction = async () => {
|
||||
expanded = !expanded;
|
||||
if (expanded && services.length === 0) {
|
||||
await loadInfo();
|
||||
|
@ -36,7 +31,18 @@
|
|||
if (expanded) {
|
||||
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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue