feat: implement RootLayout with dynamic provider loading and metadata generation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
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 Footer from '../components/Footer';
|
||||
import { getSiteSettings } from '../lib/settings';
|
||||
@@ -7,11 +7,9 @@ import { Metadata } from 'next';
|
||||
import { Inter, Playfair_Display } from 'next/font/google';
|
||||
import './globals.css';
|
||||
|
||||
// 2. LA MAGIE EST ICI : On force Next.js à ignorer les Providers pendant le build serveur
|
||||
const Providers = dynamic(
|
||||
() => import('../components/Providers').then((mod) => mod.Providers),
|
||||
{ ssr: false } // Interdit le Server-Side Rendering pour tout ce qui est dedans !
|
||||
);
|
||||
// 2. LA MAGIE EST ICI : On force Next.js a ignorer les Providers pendant le build serveur
|
||||
const Providers = nextDynamic(() => import('../components/Providers').then((mod) => mod.Providers), { ssr: false });
|
||||
|
||||
|
||||
const inter = Inter({
|
||||
subsets: ['latin'],
|
||||
@@ -25,7 +23,7 @@ const playfair = Playfair_Display({
|
||||
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> {
|
||||
const settings = await getSiteSettings();
|
||||
|
||||
Reference in New Issue
Block a user