From 5fdcc56409a0bc75171df25ca50b6e09ffe7bf3a Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 15 Jan 2023 17:40:47 -0800 Subject: Aa/bump dfl navigation fix jan2023 (#341) * fix React DevTools * bump DFL to fix Navigation * Bump DFL and add shims * fix shims not applying due to timing issue Co-authored-by: AAGaming --- frontend/src/index.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'frontend/src') diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index 03010e13..86dd90e1 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -1,3 +1,5 @@ +import { Navigation, Router, sleep } from 'decky-frontend-lib'; + import PluginLoader from './plugin-loader'; import { DeckyUpdater } from './updater'; @@ -14,6 +16,22 @@ declare global { } } +(async () => { + try { + if (!Router.NavigateToAppProperties || !Router.NavigateToLibraryTab || !Router.NavigateToInvites) { + while (!Navigation.NavigateToAppProperties) await sleep(100); + const shims = { + NavigateToAppProperties: Navigation.NavigateToAppProperties, + NavigateToInvites: Navigation.NavigateToInvites, + NavigateToLibraryTab: Navigation.NavigateToLibraryTab, + }; + Object.assign(Router, shims); + } + } catch (e) { + console.error('[DECKY]: Error initializing Navigation interface shims', e); + } +})(); + (async () => { window.deckyAuthToken = await fetch('http://127.0.0.1:1337/auth/token').then((r) => r.text()); -- cgit v1.2.3