fix: remove deprecated eslint config and make dashboard DB enrichment optional

- Remove unsupported `eslint` key from next.config.ts (Next.js 16)
- Wrap dashboard DB enrichment in try/catch so the dashboard renders
  even when PostgreSQL is unavailable, preventing the
  "Impossible de charger le tableau de bord" error

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Opus 4.7 committed 2026-04-23 10:25:45 +02:00
1 parent 42e39a1c2b
commit 64da878abb
2 files changed
+10 -7

No files matched your search

-3
View File
@@ -10,9 +10,6 @@ const nextConfig = {
typescript: { typescript: {
ignoreBuildErrors: true, ignoreBuildErrors: true,
}, },
eslint: {
ignoreDuringBuilds: true,
},
}; };
export default nextConfig; export default nextConfig;
+10 -4
View File
@@ -601,8 +601,12 @@ export async function pgGetDashboardData(): Promise<DashboardData> {
]; ];
const allCodeins = [...new Set(allItems.map(i => i.codein).filter(Boolean))]; const allCodeins = [...new Set(allItems.map(i => i.codein).filter(Boolean))];
// Enrichissement : stock et fournisseur via PostgreSQL // Enrichissement : stock et fournisseur via PostgreSQL (optionnel — le dashboard
const [stockMap, fouResult] = await Promise.all([ // s'affiche même si la DB n'est pas configurée).
let stockMap = new Map<string, { stock292: number; stock579: number; stockTotal: number }>();
let fouMap = new Map<string, string>();
try {
const [sm, fouResult] = await Promise.all([
pgGetStockForCodeins(allCodeins), pgGetStockForCodeins(allCodeins),
pgNoParallel(sql` pgNoParallel(sql`
SELECT SELECT
@@ -614,11 +618,13 @@ export async function pgGetDashboardData(): Promise<DashboardData> {
WHERE a.codein = ANY(string_to_array(${allCodeins.join(",")}, ',')) WHERE a.codein = ANY(string_to_array(${allCodeins.join(",")}, ','))
`), `),
]); ]);
stockMap = sm;
const fouMap = new Map<string, string>();
for (const row of fouResult.rows as unknown as { codein: string; fournisseur: string }[]) { for (const row of fouResult.rows as unknown as { codein: string; fournisseur: string }[]) {
if (row.codein) fouMap.set(row.codein, row.fournisseur); if (row.codein) fouMap.set(row.codein, row.fournisseur);
} }
} catch (enrichErr) {
console.warn("[Dashboard] DB enrichment unavailable, continuing with API data only:", enrichErr);
}
const siteSet = [...new Set(allItems.map(i => i.site).filter(Boolean))].sort(); const siteSet = [...new Set(allItems.map(i => i.site).filter(Boolean))].sort();