-
Notifications
You must be signed in to change notification settings - Fork 101
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
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function #14
Comments
Hey @azz0r, This was just fixed in a recent PR :) about to publish 1.0.2. Shouldn't happen any more! |
I have the same issue with I'm building a countdown with audio signals.
Is there anything I do wrong? By the way I tried to stop the sounds during clean up, but didn't help. The component is removed after the countdown is finished and then I get the error:
Update: Ok. Stopping actually works if I use a separate
Update 2: I moved the |
@joshwcomeau actually got this warning as well, it occurs after navigating to another page in Gatsby. Any chance you can re-open this? const Button = props => {
const [play] = useSound(bubble, { volume: 1 })
const executeClick = () => {
play()
props.onClick && props.onClick()
}
return (
<ButtonWrapper props={props} onClick={executeClick}>
{props.children}
</ButtonWrapper>
)
}
|
This issue still occurs because the play function changes state asynchronously. |
Great catch @alatarus, this does seem like the root of the issue. I'm experiencing this on v1.0.2 as well. @joshwcomeau could we get this issue reopened? |
Actually it looks like this line is causing this error for me: |
Good catch 👍 My hunch is we'd have to solve this with an I'm happy to reopen the issue, but I'm afraid that's about all I can do right now; I have a limited amount of typing ability in a given day, due to a medical issue. If anyone wants to open a PR I'm open to that! Though I can't promise a speedy review. |
still happening in latest version - any suggestions?
|
I'm also seeing this issue in v4.0.1 with react v17.0.2 . Calling @joshwcomeau any idea what this could be ? |
I have the same problem here const [play, { stop }] = useSound(alertSfx); const alertsCritical = useSelector((state) => state.alerts.alertsCritical, shallowEqual); useEffect(() => { |
Same problem here (4.0.1) @meowsus
(the use of Thanks! |
Hey interesting issue - I'm redirecting a user after a sound and it looks like potentially a useEffect within use-sound isn't returning a way to unmount. Thoughts?
Console errors:
Line 37 is onBeep declaration
The text was updated successfully, but these errors were encountered: