diff --git a/front/apps/mobile/app/_layout.tsx b/front/apps/mobile/app/_layout.tsx index 8a05aad7..bebe9c1a 100644 --- a/front/apps/mobile/app/_layout.tsx +++ b/front/apps/mobile/app/_layout.tsx @@ -76,6 +76,7 @@ const ThemedStack = ({ onLayout }: { onLayout?: () => void }) => { ); }; +let rendered: boolean = false; export default function Root() { const [queryClient] = useState(() => createQueryClient()); @@ -83,7 +84,8 @@ export default function Root() { const [fontsLoaded] = useFonts({ Poppins_300Light, Poppins_400Regular, Poppins_900Black }); const info = useAccounts(); - if (!fontsLoaded || info.type === "loading") return ; + if (!fontsLoaded || (!rendered && info.type === "loading")) return ; + rendered = true; return ( diff --git a/front/apps/mobile/app/index.tsx b/front/apps/mobile/app/index.tsx index 37bcba78..bcfc3f53 100644 --- a/front/apps/mobile/app/index.tsx +++ b/front/apps/mobile/app/index.tsx @@ -34,6 +34,7 @@ export const useAccounts = () => { status: "ok" | "error" | "loading" | "unverified"; error?: string; }>({ status: "loading" }); + const [retryCount, setRetryCount] = useState(0); // TODO: Remember the last selected account. const selected = accounts?.length ? 0 : null; @@ -55,7 +56,7 @@ export const useAccounts = () => { if (accounts && selected !== null) check(); else setVerified({status: "unverified"}); - }, [accounts, selected]); + }, [accounts, selected, retryCount]); if (accounts === null || verified.status === "loading") return { type: "loading" } as const; if (accounts !== null && verified.status === "unverified") return { type: "loading" } as const; @@ -63,7 +64,10 @@ export const useAccounts = () => { return { type: "error", error: verified.error, - retry: () => setVerified({ status: "loading" }), + retry: () => { + setVerified({ status: "loading" }) + setRetryCount((x) => x + 1); + }, } as const; } return { type: "ok", accounts, selected } as const;