fix(media-grid): clear pending copy-url timers on unmount

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 [error, setError] = useState<string | null>(null);
const fileRef = useRef<HTMLInputElement>(null);
const copyTimers = useRef<Set<ReturnType<typeof setTimeout>>>(new Set());
const load = useCallback(async () => {
setLoading(true);
@@ -40,6 +41,12 @@ export function AdminMediaGrid() {
setLoading(false);
}, []);
useEffect(() => {
return () => {
for (const t of copyTimers.current) clearTimeout(t);
copyTimers.current.clear();
};
}, []);
useEffect(() => {
load();
}, [load]);