diff options
| author | AAGaming <aa@mail.catvibers.me> | 2022-12-31 21:53:39 -0500 |
|---|---|---|
| committer | AAGaming <aa@mail.catvibers.me> | 2022-12-31 21:53:39 -0500 |
| commit | fdbc508fa8cb9ad3629486cacc1c92abb2500794 (patch) | |
| tree | 06bdb7db18dfcad7b577821cf048dd5f6ecdfc71 /frontend/src/router-hook.tsx | |
| parent | 81fbd0f83f11d5074bb945f0f6d7b6508e9d32d7 (diff) | |
| download | decky-loader-fdbc508fa8cb9ad3629486cacc1c92abb2500794.tar.gz decky-loader-fdbc508fa8cb9ad3629486cacc1c92abb2500794.zip | |
Main menu and overlay patching API
Diffstat (limited to 'frontend/src/router-hook.tsx')
| -rw-r--r-- | frontend/src/router-hook.tsx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/frontend/src/router-hook.tsx b/frontend/src/router-hook.tsx index bf3ae0cb..c24e2a73 100644 --- a/frontend/src/router-hook.tsx +++ b/frontend/src/router-hook.tsx @@ -120,6 +120,8 @@ class RouterHook extends Logger { return <>{renderedComponents}</>; }; + let globalComponents: any; + this.wrapperPatch = afterPatch(this.gamepadWrapper, 'render', (_: any, ret: any) => { if (ret?.props?.children?.props?.children?.length == 5 || ret?.props?.children?.props?.children?.length == 4) { const idx = ret?.props?.children?.props?.children?.length == 4 ? 1 : 2; @@ -143,11 +145,17 @@ class RouterHook extends Logger { this.memoizedRouter = memo(this.router.type); this.memoizedRouter.isDeckyRouter = true; } - ret.props.children.props.children.push( - <DeckyGlobalComponentsStateContextProvider deckyGlobalComponentsState={this.globalComponentsState}> - <DeckyGlobalComponentsWrapper /> - </DeckyGlobalComponentsStateContextProvider>, - ); + + if (!globalComponents) { + globalComponents = ( + <DeckyGlobalComponentsStateContextProvider deckyGlobalComponentsState={this.globalComponentsState}> + <DeckyGlobalComponentsWrapper /> + </DeckyGlobalComponentsStateContextProvider> + ); + } + + ret.props.children.props.children.push(globalComponents); + ret.props.children.props.children[idx].props.children[0].type = this.memoizedRouter; } } |
