From f494579e1a1a6272d1b360c06d865013dc871665 Mon Sep 17 00:00:00 2001 From: ht Date: Sun, 6 Sep 2026 17:25:10 +0300 Subject: [PATCH] validate delivery queue rows --- src/components/tools/DeliveryQueue.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/tools/DeliveryQueue.jsx b/src/components/tools/DeliveryQueue.jsx index 86cc24c..93be784 100644 --- a/src/components/tools/DeliveryQueue.jsx +++ b/src/components/tools/DeliveryQueue.jsx @@ -10,7 +10,13 @@ function Queue({weekly}){ const endpoint=weekly?'/api/admin/brief/outbox':'/api/admin/notify/outbox'; const [rows,setRows]=useState(null),[error,setError]=useState(null),[busy,setBusy]=useState(false); const alive=useRef(true),locked=useRef(false); - const load=async()=>{const data=await accountRequest(endpoint);const rows=requireArray(data,'deliveries');if(alive.current)setRows(rows);}; + const load=async()=>{ + const data=await accountRequest(endpoint); + const received=requireArray(data,'deliveries'); + const rows=received.filter(row=>row && typeof row==='object' && typeof row.id==='string' && row.id.trim() && typeof row.state==='string'); + if(rows.length!==received.length)throw new Error('Sunucu gönderim kayıtlarından birini geçersiz döndürdü. Liste yenilenemedi.'); + if(alive.current)setRows(rows); + }; const act=async fn=>{if(locked.current)return;locked.current=true;setBusy(true);setError(null);try{await fn();}catch(e){if(alive.current)setError(e.message);}finally{locked.current=false;if(alive.current)setBusy(false);}}; useEffect(()=>{alive.current=true;void act(load);return()=>{alive.current=false;};},[]); return