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
[@mantine/hooks] Interval Hook start() creates unbounded intervals #782
Comments
PR was merged |
I think this does not completly solve the issue. When calling the If I am correct, the following would solve that issue: const start = () => {
setActive(old => {
if (!old) {
intervalRef.current = window.setInterval(fn, interval);
}
return true;
});
}; |
I agree you want to submit a PR? |
Yes, did so |
@prograpp I still found a bug with this where I am seeing it hold two instances of my interval timer that was not happening before your fix. I am going to submit another fix. |
What package has an issue
@mantine/hooks
Describe the bug
If you call
interval.start()
X times it starts X timers but calling stop can only stop the latest one.In which browser did the problem occur
ALL
If possible, please include a link to a codesandbox with the reproduced problem
https://codesandbox.io/s/sharp-matan-zx040?file=/src/App.tsx
Do you know how to fix the issue
Yes
Are you willing to participate in fixing this issue and create a pull request with the fix
Yes
Possible fix
PR being submitted with...
The text was updated successfully, but these errors were encountered: