Skip to content

Commit

Permalink
quick fix for routes refreshing constantly
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Jul 24, 2022
1 parent 2004bde commit 52dded8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions frontend/src/router-hook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 52dded8

Please sign in to comment.