mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 10:27:49 +00:00
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.
This commit is contained in:
@@ -369,7 +369,7 @@ export default function NewsSection() {
|
|||||||
gcTime: 10 * 60_000,
|
gcTime: 10 * 60_000,
|
||||||
});
|
});
|
||||||
|
|
||||||
const items = data?.items ?? [];
|
const items = useMemo(() => data?.items ?? [], [data?.items]);
|
||||||
const total = data?.total ?? 0;
|
const total = data?.total ?? 0;
|
||||||
const categories = data?.categories ?? [];
|
const categories = data?.categories ?? [];
|
||||||
|
|
||||||
|
|||||||
@@ -181,10 +181,12 @@ export default function AdminTickets() {
|
|||||||
|
|
||||||
// Cancel in-flight uploads and cleanup blob URL on unmount
|
// Cancel in-flight uploads and cleanup blob URL on unmount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const uploadRef = uploadIdRef;
|
||||||
|
const prevRef = previewRef;
|
||||||
return () => {
|
return () => {
|
||||||
uploadIdRef.current++;
|
uploadRef.current++;
|
||||||
if (previewRef.current) {
|
if (prevRef.current) {
|
||||||
URL.revokeObjectURL(previewRef.current);
|
URL.revokeObjectURL(prevRef.current);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user