fix: resolve Google login hydration mismatch and dynamic env load
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m42s

This commit is contained in:
2026-06-07 12:21:06 +02:00
parent 5b8c29dae6
commit feea02033b
6 changed files with 127 additions and 7 deletions

View File

@@ -27,6 +27,7 @@ import { apiClient } from '@/lib/apiClient';
import { useRegister } from './useRegister';
import { cn } from '@/lib/utils';
import type { GoogleAuthResponse } from '../login/types';
import { useGoogleConfig } from '@/providers/ClientGoogleProvider';
function validateEmail(email: string) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
@@ -85,7 +86,7 @@ export function RegisterForm() {
const searchParams = useSearchParams();
const redirect = searchParams.get('redirect') || '/dashboard';
const googleClientId = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || '';
const { clientId: googleClientId, enabled: googleEnabled } = useGoogleConfig();
const nameError = touched.name && name.length > 0 && name.length < 2
? t('register.name.error')
@@ -179,7 +180,7 @@ export function RegisterForm() {
</CardHeader>
<CardContent className="space-y-5">
{googleClientId && (
{googleEnabled && googleClientId && (
<>
<div className="flex justify-center">
{googleLoading ? (