Skip to content

Commit

Permalink
fix: tomo ssr issue (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
totraev authored Oct 28, 2024
1 parent 91fb335 commit e274321
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/common/AuthGuard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import type { PropsWithChildren, ReactNode } from "react";
import {
useEffect,
useState,
type PropsWithChildren,
type ReactNode,
} from "react";

import { useWalletConnection } from "@/app/context/wallet/WalletConnectionProvider";

Expand All @@ -11,6 +16,11 @@ export function AuthGuard({
fallback,
}: PropsWithChildren<AuthGuardProps>) {
const { isConnected } = useWalletConnection();
const [displayComponent, setDisplayComponent] = useState(false);

return isConnected ? children : fallback;
useEffect(() => {
setDisplayComponent(isConnected);
}, [isConnected]);

return displayComponent ? children : fallback;
}

0 comments on commit e274321

Please sign in to comment.