-
Notifications
You must be signed in to change notification settings - Fork 7
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
Prevent Repeat Calls of usePleaseStay #1
Comments
can I work on this? |
Definitely! I've assigned you. |
When the custom hook Hence tracked whether animation is triggerd or not by setting a variable on windows object in #8 . Is this fine? |
@hariharan-ingersal - sure. But please make the value of it the interval ID - and then we should also be sure to remove the interval on hook unmount. I'm not sure if I do that yet, I haven't looked at the hook code in detail in a while. Then for the dev / prod checking I think there are some examples in the existing code how to do that. |
As the README states, one pitfall of this hook is that it should only be called once across an entire codebase - otherwise, it will create multiple timeout interactions on the
document.title
and will ruin the effect, not to mention add extra load to the browser. I'm looking for a code-based way to prevent this from occurring - perhaps by assigning an ID from thesetInterval
command:https://developer.mozilla.org/en-US/docs/Web/API/setInterval
Logic should be something like as follows:
ref
would work)new Error()
be thrownreturn
from the function)The text was updated successfully, but these errors were encountered: