Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: await init-user before completing auth and add missing user dep

Gabriel Stein3686b63cb9ff
diff --git a/src/components/AuthenticationStep.tsx b/src/components/AuthenticationStep.tsx
index 78ee16a21..855d6557a 100644
--- a/src/components/AuthenticationStep.tsx
+++ b/src/components/AuthenticationStep.tsx
@@ -92,21 +92,31 @@ export default function AuthenticationStep({
}, []);
useEffect(() => {
- if (isLoaded && isSignedIn && !needsVerificationRef.current) {
- if (OPENWHISPR_API_URL && user?.id && user?.email) {
- fetch(`${OPENWHISPR_API_URL}/api/auth/init-user`, {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({
- userId: user.id,
- email: user.email,
- name: user.name || null,
- }),
- }).catch((err) => logger.error("Failed to init user", err, "auth"));
+ if (!isLoaded || !isSignedIn || needsVerificationRef.current || !user?.id || !user?.email) return;
+
+ const initAndComplete = async () => {
+ if (OPENWHISPR_API_URL) {
+ try {
+ const res = await fetch(`${OPENWHISPR_API_URL}/api/auth/init-user`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ userId: user.id,
+ email: user.email,
+ name: user.name || null,
+ }),
+ });
+ if (!res.ok) {
+ logger.error("init-user returned non-OK", { status: res.status }, "auth");
+ }
+ } catch (err) {
+ logger.error("Failed to init user", err, "auth");
+ }
}
onAuthComplete();
- }
- }, [isLoaded, isSignedIn, onAuthComplete]);
+ };
+ initAndComplete();
+ }, [isLoaded, isSignedIn, user, onAuthComplete]);
useEffect(() => {
if (isSocialLoading === null) return;