From a074277bb58428a64295154ebf96aceb96e654a7 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Fri, 28 Oct 2022 18:42:28 -0400 Subject: [PATCH] fix(tabs): fix on stable for real this time i think --- src/deck-components/Tabs.tsx | 37 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/deck-components/Tabs.tsx b/src/deck-components/Tabs.tsx index c57f4f2..2d3558d 100644 --- a/src/deck-components/Tabs.tsx +++ b/src/deck-components/Tabs.tsx @@ -109,27 +109,30 @@ try { } return false; }); - if (oldTabsModule) oldTabs = Object.values(oldTabsModule).find((x: any) => x?.type?.toString()?.includes("((function(") && x?.type?.toString()?.includes("[\"tabs\"")); + if (oldTabsModule) + oldTabs = Object.values(oldTabsModule).find((x: any) => x?.type?.toString()?.includes('((function(){')); } catch (e) { - console.error("Error finding oldTabs:", e) + console.error('Error finding oldTabs:', e); } /** * Tabs component as used in the library and media tabs. See {@link TabsProps} * Unlike other components in `decky-frontend-lib`, this requires Decky Loader to be running. */ -export const Tabs = oldTabs || ((props: TabsProps) => { - const found = tabsComponent; - const [tc, setTC] = useState>(found); - useEffect(() => { - if (found) return; - (async () => { - console.debug('[DFL:Tabs]: Finding component...'); - const t = await getTabs(); - console.debug('[DFL:Tabs]: Found!'); - setTC(t); - })(); - }, []); - console.log('tc', tc); - return tc ? createElement(tc, props) : ; -}) as FC; +export const Tabs = + oldTabs || + (((props: TabsProps) => { + const found = tabsComponent; + const [tc, setTC] = useState>(found); + useEffect(() => { + if (found) return; + (async () => { + console.debug('[DFL:Tabs]: Finding component...'); + const t = await getTabs(); + console.debug('[DFL:Tabs]: Found!'); + setTC(t); + })(); + }, []); + console.log('tc', tc); + return tc ? createElement(tc, props) : ; + }) as FC);