- Update providers to always render GoogleOAuthProvider with dummy ID when not configured - This prevents "must be used within GoogleOAuthProvider" errors during SSR - The login page still checks for valid client ID before showing Google button - Fixes dev mode errors and ensures consistent behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
20 lines
627 B
TypeScript
20 lines
627 B
TypeScript
"use client";
|
|
|
|
import { GoogleOAuthProvider } from "@react-oauth/google";
|
|
import { AuthProvider } from "@/contexts/AuthContext";
|
|
import { ReactNode } from "react";
|
|
|
|
export function Providers({ children }: { children: ReactNode }) {
|
|
// Use a dummy client ID if not provided to prevent context errors
|
|
// The actual authentication will still check for a valid ID
|
|
const googleClientId = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || 'dummy-client-id-not-configured';
|
|
|
|
return (
|
|
<GoogleOAuthProvider clientId={googleClientId}>
|
|
<AuthProvider>
|
|
{children}
|
|
</AuthProvider>
|
|
</GoogleOAuthProvider>
|
|
);
|
|
}
|