diff options
| -rw-r--r-- | frontend/src/router-hook.tsx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/frontend/src/router-hook.tsx b/frontend/src/router-hook.tsx index e318930e..4e23658e 100644 --- a/frontend/src/router-hook.tsx +++ b/frontend/src/router-hook.tsx @@ -41,11 +41,16 @@ class RouterHook extends Logger { const DeckyWrapper = ({ children }: { children: ReactElement }) => { const { routes } = useDeckyRouterState(); - const routerIndex = children.props.children[0].props.children.length; + let routerIndex = children.props.children[0].props.children.length; if ( - !children.props.children[0].props.children[routerIndex]?.length || - children.props.children[0].props.children[routerIndex].length !== routes.size + !children.props.children[0].props.children[routerIndex - 1]?.length || + children.props.children[0].props.children[routerIndex - 1]?.length !== routes.size ) { + if ( + children.props.children[0].props.children[routerIndex - 1]?.length && + children.props.children[0].props.children[routerIndex - 1].length !== routes.size + ) + routerIndex--; const newRouterArray: ReactElement[] = []; routes.forEach(({ component, props }, path) => { newRouterArray.push( |
