From 2d8acd5447943c6861adf20a42001eb0d55e206e Mon Sep 17 00:00:00 2001 From: Meghea Iulian Date: Fri, 25 Sep 2020 09:58:08 +0300 Subject: [PATCH] fix(cosmoz-tabs): delays initial setTabs to microtask In Firefox the `slotchange` fires a bit too soon ... --- lib/use-tabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/use-tabs.js b/lib/use-tabs.js index 602e5b6..12ee2cf 100644 --- a/lib/use-tabs.js +++ b/lib/use-tabs.js @@ -59,7 +59,7 @@ const useTabSelectedEffect = (host, selectedTab) => { return { tabs, selectedTab, - onSlot: useCallback(({ target }) => setTabs(target.assignedElements().filter(el => el.matches('cosmoz-tab'))), []), + onSlot: useCallback(({ target }) => queueMicrotask(() => setTabs(target.assignedElements().filter(el => el.matches('cosmoz-tab')))), []), onSelect: useCallback(e => { if (e.button !== 0 || e.metaKey || e.ctrlKey) { return;