diff --git a/src/components/common/AuthGuard/index.tsx b/src/components/common/AuthGuard/index.tsx index eb248fd7..0a6bc3b4 100644 --- a/src/components/common/AuthGuard/index.tsx +++ b/src/components/common/AuthGuard/index.tsx @@ -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"; @@ -11,6 +16,11 @@ export function AuthGuard({ fallback, }: PropsWithChildren) { const { isConnected } = useWalletConnection(); + const [displayComponent, setDisplayComponent] = useState(false); - return isConnected ? children : fallback; + useEffect(() => { + setDisplayComponent(isConnected); + }, [isConnected]); + + return displayComponent ? children : fallback; }