Skip to content

Commit

Permalink
Only redirect to /login when we're ready!
Browse files Browse the repository at this point in the history
Prevents redundant redirect.
  • Loading branch information
dokterbob committed Nov 27, 2024
1 parent 0740a9c commit 7d606ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/pages/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Props = {
};

const Page = ({ children }: Props) => {
const { isAuthenticated } = useAuth();
const { isAuthenticated, isReady } = useAuth();
const { config } = useConfig();
const userEnv = useRecoilValue(userEnvState);
const sideViewElement = useRecoilValue(sideViewState);
Expand All @@ -29,7 +29,7 @@ const Page = ({ children }: Props) => {
}
}

if (!isAuthenticated) {
if (isReady && !isAuthenticated) {
return <Navigate to="/login" />;
}

Expand Down

0 comments on commit 7d606ca

Please sign in to comment.