fix(media-grid): clear pending copy-url timers on unmount
CI / check (push) Successful in 42s
CI / tests-unit (push) Successful in 2m33s
CI / tests-integration (push) Successful in 2m14s
CI / tests-ui (push) Failing after 2m31s
CI / preflight (push) Skipped
CI / deploy (push) Skipped
CI / tests-quality (push) Successful in 1m29s
CI / tests-imaging-browsers (push) Successful in 1m52s

This commit is contained in:
openhands committed 2026-10-22 18:36:45 +02:00
1 parent 3cb5baabfb
commit a16e9da018
1 file changed
+7
+7
View File
@@ -33,6 +33,7 @@ export function AdminMediaGrid() {
const [copied, setCopied] = useState<string | null>(null); const [copied, setCopied] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
const fileRef = useRef<HTMLInputElement>(null); const fileRef = useRef<HTMLInputElement>(null);
const copyTimers = useRef<Set<ReturnType<typeof setTimeout>>>(new Set());
const load = useCallback(async () => { const load = useCallback(async () => {
setLoading(true); setLoading(true);
@@ -40,6 +41,12 @@ export function AdminMediaGrid() {
setLoading(false); setLoading(false);
}, []); }, []);
useEffect(() => {
return () => {
for (const t of copyTimers.current) clearTimeout(t);
copyTimers.current.clear();
};
}, []);
useEffect(() => { useEffect(() => {
load(); load();
}, [load]); }, [load]);