Support useRafInterval
hook
#7282
lvchenyang
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently,
@mantine/hooks
providesuseInterval
. However, the existinguseInterval
does not maintain accurate timing when the main thread is blocked. For example, if I useuseInterval
to implement a UI-based timer displayed on the page, and there are user interactions or ifsetTimeout
is called for some delayed operations, the next tick ofuseInterval
will wait forsetTimeout
to complete. This results in the timer display on the UI becoming completely inaccurate.I hope to implement a
useRafInterval
hook based on therequestAnimationFrame
function to reduce timing inaccuracies caused by main thread blocking.Beta Was this translation helpful? Give feedback.
All reactions