diff --git a/front/apps/mobile/app/index.tsx b/front/apps/mobile/app/index.tsx index 5a36c008..c3ff47d8 100644 --- a/front/apps/mobile/app/index.tsx +++ b/front/apps/mobile/app/index.tsx @@ -55,15 +55,16 @@ export const useAccounts = () => { if (accounts && selected !== null) check(); else setVerified({status: "unverified"}); - }, [accounts, selected, verified.status]); + }, [accounts, selected]); if (accounts === null || verified.status === "loading") return { type: "loading" } as const; + if (accounts !== null && verified.status === "unverified") return { type: "loading" } as const; if (verified.status === "error") { return { type: "error", error: verified.error, retry: () => setVerified({ status: "loading" }), - }; + } as const; } return { type: "ok", accounts, selected } as const; }; @@ -86,13 +87,8 @@ export const ConnectionError = ({ error, retry }: { error?: string; retry: () => export const AccountContext = createContext>({ type: "loading" }); -let initialRender = true; - const App = () => { - // Using context on the initial one to keep the splashscreen and not show a spinner. - // eslint-disable-next-line react-hooks/rules-of-hooks - const info = initialRender ? useContext(AccountContext) : useAccounts(); - initialRender = false; + const info = useContext(AccountContext); if (info.type === "loading") return if (info.type === "error") return ; if (info.selected === null) return ;