From e86b214008ce378e26f250a0601aae2002b8dbf9 Mon Sep 17 00:00:00 2001 From: c0mrade Date: Wed, 25 Mar 2026 11:47:41 +0300 Subject: [PATCH] fix: resolve eslint warnings in NewsSection and AdminTickets NewsSection: wrap items in useMemo to stabilize dependency reference. AdminTickets: copy ref values to local vars for cleanup function. --- src/components/news/NewsSection.tsx | 2 +- src/pages/AdminTickets.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/news/NewsSection.tsx b/src/components/news/NewsSection.tsx index 0c99707..0ea43ae 100644 --- a/src/components/news/NewsSection.tsx +++ b/src/components/news/NewsSection.tsx @@ -369,7 +369,7 @@ export default function NewsSection() { gcTime: 10 * 60_000, }); - const items = data?.items ?? []; + const items = useMemo(() => data?.items ?? [], [data?.items]); const total = data?.total ?? 0; const categories = data?.categories ?? []; diff --git a/src/pages/AdminTickets.tsx b/src/pages/AdminTickets.tsx index 4253912..5ae505f 100644 --- a/src/pages/AdminTickets.tsx +++ b/src/pages/AdminTickets.tsx @@ -181,10 +181,12 @@ export default function AdminTickets() { // Cancel in-flight uploads and cleanup blob URL on unmount useEffect(() => { + const uploadRef = uploadIdRef; + const prevRef = previewRef; return () => { - uploadIdRef.current++; - if (previewRef.current) { - URL.revokeObjectURL(previewRef.current); + uploadRef.current++; + if (prevRef.current) { + URL.revokeObjectURL(prevRef.current); } }; }, []);