From ee2ba0b3b94ff7d2c043724f9d0605da62948d1f Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Mon, 16 Feb 2026 07:48:48 +0000 Subject: [PATCH] Update how IP addresses are checked for whitelisting Correctly handle whitelist data response format in detections page to prevent runtime errors. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: c1ba4b9b-0664-47cc-9e51-47cb707b4948 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/RyXWGQA --- client/src/pages/Detections.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/client/src/pages/Detections.tsx b/client/src/pages/Detections.tsx index 5989974..c4ee718 100644 --- a/client/src/pages/Detections.tsx +++ b/client/src/pages/Detections.tsx @@ -73,13 +73,12 @@ export default function Detections() { const totalCount = data?.total || 0; const totalPages = Math.ceil(totalCount / ITEMS_PER_PAGE); - // Fetch whitelist to check if IP is already whitelisted - const { data: whitelistData } = useQuery({ - queryKey: ["/api/whitelist"], + const { data: whitelistData } = useQuery<{ items: Whitelist[]; total: number }>({ + queryKey: ["/api/whitelist", "all"], + queryFn: () => fetch("/api/whitelist?limit=10000").then(r => r.json()), }); - // Create a Set of whitelisted IPs for fast lookup - const whitelistedIps = new Set(whitelistData?.map(w => w.ipAddress) || []); + const whitelistedIps = new Set(whitelistData?.items?.map(w => w.ipAddress) || []); // Mutation per aggiungere a whitelist const addToWhitelistMutation = useMutation({