Unverified Commit 40216be6 authored by Gerald Monaco's avatar Gerald Monaco Committed by GitHub

Workaround for discrete passive effects change (#24369)

This test is failing for the same reason as https://github.com/facebook/react/pull/21173, so we'll borrow their fix, and follow along for updates.
parent 079c6291
......@@ -13,9 +13,15 @@ const useClickAway = (ref, onClickAway) => {
el && !el.contains(event.target) && onClickAway(event)
}
document.addEventListener('click', handler)
let timeoutID = setTimeout(() => {
timeoutID = null
document.addEventListener('click', handler)
}, 0)
return () => {
if (timeoutID != null) {
clearTimeout(timeoutID)
}
document.removeEventListener('click', handler)
}
}, [onClickAway, ref])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment