feat: implement RootLayout with dynamic provider loading and metadata generation

This commit is contained in:
2026-05-06 20:37:39 +02:00
parent a37b34f758
commit 19b405d9f2

View File

@@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import dynamic from 'next/dynamic'; // <-- 1. On importe l'outil dynamique import nextDynamic from 'next/dynamic'; // <-- 1. On importe l'outil dynamique
import Navbar from '../components/Navbar'; import Navbar from '../components/Navbar';
import Footer from '../components/Footer'; import Footer from '../components/Footer';
import { getSiteSettings } from '../lib/settings'; import { getSiteSettings } from '../lib/settings';
@@ -7,11 +7,9 @@ import { Metadata } from 'next';
import { Inter, Playfair_Display } from 'next/font/google'; import { Inter, Playfair_Display } from 'next/font/google';
import './globals.css'; import './globals.css';
// 2. LA MAGIE EST ICI : On force Next.js à ignorer les Providers pendant le build serveur // 2. LA MAGIE EST ICI : On force Next.js a ignorer les Providers pendant le build serveur
const Providers = dynamic( const Providers = nextDynamic(() => import('../components/Providers').then((mod) => mod.Providers), { ssr: false });
() => import('../components/Providers').then((mod) => mod.Providers),
{ ssr: false } // Interdit le Server-Side Rendering pour tout ce qui est dedans !
);
const inter = Inter({ const inter = Inter({
subsets: ['latin'], subsets: ['latin'],
@@ -25,7 +23,7 @@ const playfair = Playfair_Display({
display: 'swap', display: 'swap',
}); });
export const dynamicMode = 'force-dynamic'; // Renommé pour éviter les conflits de variables export const dynamic = 'force-dynamic'; // Restauration du nom standard
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
const settings = await getSiteSettings(); const settings = await getSiteSettings();