fileRenderInitiator: missing timer cleanup

This commit is contained in:
infinite-persistence 2022-03-17 08:44:54 +08:00 committed by Thomas Zarebczan
parent 32d5eaf8e1
commit 7dd7aac8d2

View file

@ -112,7 +112,7 @@ export default function FileRenderInitiator(props: Props) {
React.useEffect(() => {
if (!claimThumbnail) return;
setTimeout(() => {
const timer = setTimeout(() => {
let newThumbnail = claimThumbnail;
if (
@ -128,6 +128,8 @@ export default function FileRenderInitiator(props: Props) {
setThumbnail(newThumbnail);
}
}, 200);
return () => clearTimeout(timer);
}, [claimThumbnail, thumbnail]);
function handleClick() {