diff --git a/src/app/(dashboard)/hosts/page.tsx b/src/app/(dashboard)/hosts/page.tsx index 8ef218f..de51258 100644 --- a/src/app/(dashboard)/hosts/page.tsx +++ b/src/app/(dashboard)/hosts/page.tsx @@ -15,6 +15,10 @@ import { } from '@/components/ui/table'; import { prisma } from '@/lib/db/prisma'; +// L'inventaire évolue à chaque scan : pas de cache de route +export const dynamic = 'force-dynamic'; +export const revalidate = 0; + async function getHosts() { try { return await prisma.host.findMany({ diff --git a/src/app/(dashboard)/scans/page.tsx b/src/app/(dashboard)/scans/page.tsx index b728f33..a5e8bf3 100644 --- a/src/app/(dashboard)/scans/page.tsx +++ b/src/app/(dashboard)/scans/page.tsx @@ -15,6 +15,10 @@ import { import { DiscoveryLauncher } from '@/components/scans/discovery-launcher'; import { prisma } from '@/lib/db/prisma'; +// L'historique change à chaque scan : pas de cache de route +export const dynamic = 'force-dynamic'; +export const revalidate = 0; + async function getScans() { try { return await prisma.scan.findMany({ diff --git a/src/components/scans/discovery-launcher.tsx b/src/components/scans/discovery-launcher.tsx index 6d70a79..fbe0289 100644 --- a/src/components/scans/discovery-launcher.tsx +++ b/src/components/scans/discovery-launcher.tsx @@ -1,6 +1,7 @@ 'use client'; import { useState } from 'react'; +import { useRouter } from 'next/navigation'; import { Radar, Zap } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; @@ -10,6 +11,7 @@ import { Card } from '@/components/ui/card'; type Kind = 'full' | 'ping' | 'port' | 'arp' | 'mdns'; export function DiscoveryLauncher() { + const router = useRouter(); const [kind, setKind] = useState('full'); const [cidr, setCidr] = useState('192.168.1.0/24'); const [loading, setLoading] = useState(false); @@ -37,6 +39,8 @@ export function DiscoveryLauncher() { setMessage( `✓ Scan ${json.data.status} — ${json.data.hostsFound} hôtes, ${json.data.portsFound} ports`, ); + // Invalide le cache route pour que l'historique se rafraîchisse + router.refresh(); } catch (e) { setMessage(`✕ ${(e as Error).message}`); } finally {