From 26976ccea244f2e0adb531e0a94d76c50b26a498 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 3 Jun 2026 08:35:44 +0000 Subject: [PATCH] =?UTF-8?q?fix(build):=20supprime=20la=20d=C3=A9pendance?= =?UTF-8?q?=20r=C3=A9seau=20=C3=A0=20Google=20Fonts=20au=20build=20+=20ren?= =?UTF-8?q?d=20/commandes-auto=20dynamique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le build Docker échouait sur le fetch de la police Inter via next/font/google (accès réseau/TLS indisponible pendant 'next build'). - layout.tsx : charge Inter via côté navigateur (plus de fetch au build), avec fallback système ; --font-sans défini dans globals.css (@theme). - /commandes-auto : export dynamic = 'force-dynamic' (données live DB + API, jamais prérendues au build). - listCadences : résilient si la DB est injoignable (retourne []). --- src/app/(dashboard)/commandes-auto/page.tsx | 3 +++ src/app/globals.css | 8 +++++++ src/app/layout.tsx | 24 +++++++++++---------- src/features/commandes-auto/actions.ts | 15 +++++++++---- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/app/(dashboard)/commandes-auto/page.tsx b/src/app/(dashboard)/commandes-auto/page.tsx index 2b7ee83..5b5d287 100644 --- a/src/app/(dashboard)/commandes-auto/page.tsx +++ b/src/app/(dashboard)/commandes-auto/page.tsx @@ -4,6 +4,9 @@ import { CommandesAutoTabs } from "./tabs"; export type { PgCommandeAutoRow }; +// Données live (DB + API FF Nancy) : rendu à la requête, jamais prérendu au build. +export const dynamic = "force-dynamic"; + export default async function CommandesAutoPage() { const [rows, cadences, fournisseurs] = await Promise.all([ pgGetCommandesAuto(), diff --git a/src/app/globals.css b/src/app/globals.css index 2415593..f9c6aed 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1,5 +1,13 @@ @import "tailwindcss"; +/* Police de l'app : Inter (chargée via dans le layout, fallback système). + Définie ici pour que l'utilitaire `font-sans` et var(--font-sans) la prennent + sans recourir à next/font/google (pas de fetch réseau au build). */ +@theme { + --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; +} + + /* ═══════════════════════════════════════════ CollectFlow — Apple-inspired Design System ═══════════════════════════════════════════ */ diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 8fb1e34..7fbdeef 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,21 +1,12 @@ import type { Metadata } from "next"; -import { Inter } from "next/font/google"; -import { ThemeProvider } from "@/components/shared/theme-provider"; import "./globals.css"; - -const inter = Inter({ - subsets: ["latin"], - variable: "--font-sans", - display: "swap", -}); +import { Providers } from "./providers"; export const metadata: Metadata = { title: "CollectFlow — Dashboard Décisionnel", description: "Révision d'Assortiment Haute Performance", }; -import { Providers } from "./providers"; - export default function RootLayout({ children, }: Readonly<{ @@ -23,7 +14,18 @@ export default function RootLayout({ }>) { return ( - + + {/* Inter chargé côté navigateur (et non au build) pour éviter toute + dépendance réseau à Google Fonts pendant `next build` (Docker). */} + + + {/* eslint-disable-next-line @next/next/no-page-custom-font */} + + + {children} diff --git a/src/features/commandes-auto/actions.ts b/src/features/commandes-auto/actions.ts index 06d878b..7453569 100644 --- a/src/features/commandes-auto/actions.ts +++ b/src/features/commandes-auto/actions.ts @@ -45,10 +45,17 @@ export async function getFournisseursPourCadence(): Promise<{ code: string; nom: * de la dernière réception (FF Nancy). */ export async function listCadences(): Promise { - const [rows, receptions] = await Promise.all([ - db.select().from(commandeCadences), - pgGetDerniereReceptionParFournisseur(), - ]); + let rows: typeof commandeCadences.$inferSelect[] = []; + let receptions = new Map(); + try { + [rows, receptions] = await Promise.all([ + db.select().from(commandeCadences), + pgGetDerniereReceptionParFournisseur(), + ]); + } catch (e) { + console.error("[cadence] listCadences error:", (e as Error).message); + return []; + } const now = Date.now();