Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-dom): clear setTimeOut #2520

Closed
wants to merge 1 commit into from
Closed

fix(runtime-dom): clear setTimeOut #2520

wants to merge 1 commit into from

Conversation

zhangzhonghe
Copy link
Member

fix #2482

if (ended < propCount) {
end()
}
}, timeout + 1)
el.addEventListener(endEvent, onEnd)
;(el as any)[endEvent] = onEnd
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里如果使用 addEventListener 会导致快速点击时注册多个 onEnd ,在动画结束时这些 onEnd 会一起被调用。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the better way is to just clearTimeout before setTimeout.

@@ -270,12 +273,12 @@ function whenTransitionEnds(
}
}
}
setTimeout(() => {
el._timeoutID = setTimeout(() => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2482 就是因为这个 setTimeout 没有及时清除。

@yyx990803
Copy link
Member

Thanks for the PR. A cleaner fix is to simply never invoke the stale callbacks, see eaf8a67

@yyx990803 yyx990803 closed this Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<transition> is breaking/flickering when toggling really fast (spam clicking a button to toggle)
3 participants