diff options
Diffstat (limited to 'frontend/src/router-hook.tsx')
| -rw-r--r-- | frontend/src/router-hook.tsx | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/frontend/src/router-hook.tsx b/frontend/src/router-hook.tsx index a7b6ec92..bf1198fc 100644 --- a/frontend/src/router-hook.tsx +++ b/frontend/src/router-hook.tsx @@ -5,7 +5,7 @@ import { afterPatch, findInReactTree, findInTree, - findModuleByExport, + findVar, getReactRoot, sleep, } from '@decky/ui'; @@ -56,20 +56,9 @@ class RouterHook extends Logger { window.__ROUTER_HOOK_INSTANCE?.deinit?.(); window.__ROUTER_HOOK_INSTANCE = this; - const reactRouterStackModule = findModuleByExport((e) => typeof e == 'string' && e == 'router-backstack', 20); - if (reactRouterStackModule) { - this.Route = - Object.values(reactRouterStackModule).find( - (e) => typeof e == 'function' && /routePath:[\w$]+\.match\?\.path./.test(e.toString()), - ) || - Object.values(reactRouterStackModule).find( - (e) => typeof e == 'function' && /routePath:null===\(.=.\.match\)/.test(e.toString()), - ); - if (!this.Route) { - this.error('Failed to find Route component'); - } - } else { - this.error('Failed to find router stack module'); + this.Route = findVar((e) => /routePath:[\w$]+\.match\?\.path./.test(e.toString())) + if (!this.Route) { + this.error('Failed to find Route component'); } this.modeChangeRegistration = SteamClient.UI.RegisterForUIModeChanged((mode: EUIMode) => { |
