From 666fb1a1ac18fc2f4bcfdb91e8ebb5c6a3351a4b Mon Sep 17 00:00:00 2001 From: soufiane Date: Tue, 18 Nov 2025 19:03:33 +0100 Subject: [PATCH] fix: move GoogleOAuthProvider to client component to fix SSR errors --- app/layout.tsx | 23 +++++------------------ app/providers.tsx | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 app/providers.tsx diff --git a/app/layout.tsx b/app/layout.tsx index 9164607..6d70f20 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,9 +1,8 @@ import type { Metadata } from "next"; import "./globals.css"; -import { AuthProvider } from "@/contexts/AuthContext"; import { Toaster } from "react-hot-toast"; import LayoutClient from "./layout-client"; -import { GoogleOAuthProvider } from "@react-oauth/google"; +import { Providers } from "./providers"; export const metadata: Metadata = { title: "Thé Tip Top - Jeu Concours", @@ -35,26 +34,14 @@ export const metadata: Metadata = { }, }; -const googleClientId = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || ''; - export default function RootLayout({ children }: { children: React.ReactNode }) { - const content = ( - - {children} - - ); - return ( - {googleClientId ? ( - - {content} - - ) : ( - content - )} - + {children} + + + {children} + + ); + + if (googleClientId) { + return ( + + {content} + + ); + } + + return content; +}