From 80c625d4ceee193569aa0cb4b738ca5dd92fd803 Mon Sep 17 00:00:00 2001 From: phillsatellite Date: Mon, 9 Mar 2026 22:47:02 -0400 Subject: [PATCH] Fix API key modal flash on page refresh Delay authLoading=false until after Firestore apiKey fetch completes, preventing the ApiKeySetup screen from briefly appearing on refresh. --- src/App.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index da34255..0c3c978 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -66,9 +66,8 @@ export default function App() { const unsubscribe = onAuthStateChanged(auth, async (firebaseUser) => { setUser(firebaseUser); - setAuthLoading(false); if (firebaseUser) { - // Fetch API key from Firestore + // Fetch API key from Firestore before revealing the app try { const snap = await getDoc(doc(db, "users", firebaseUser.uid)); if (snap.exists() && snap.data().apiKey) { @@ -80,6 +79,7 @@ export default function App() { } else { setApiKey(""); } + setAuthLoading(false); }); return () => unsubscribe(); }, []);