修复定时器与动画回调清理不完整问题

This commit is contained in:
2026-03-03 12:27:34 +08:00
parent 45dbac1935
commit 4cd593bc30
5 changed files with 57 additions and 12 deletions
+5 -2
View File
@@ -42,7 +42,11 @@ export default function BlindboxRoomPage() {
const timersRef = useRef<ReturnType<typeof setTimeout>[]>([]);
useEffect(() => {
return () => { timersRef.current.forEach(clearTimeout); };
const timers = timersRef.current;
return () => {
timers.forEach(clearTimeout);
timers.length = 0;
};
}, []);
// Hook: Room
@@ -58,7 +62,6 @@ export default function BlindboxRoomPage() {
input, setInput, submitting, suggestions, suggestionsLoading,
suggestionsSource, poolCount, setPoolCount, myIdeas, drawnHistory,
setDrawnHistory, submitFlash, error, setError, inputRef,
boxControls: ideaBoxControls,
fetchIdeas, fetchSuggestions, refreshSuggestions,
handleSubmit, handleEditIdea, handleDeleteIdea,
} = useBlindboxIdeas(room, profile);