-
Notifications
You must be signed in to change notification settings - Fork 567
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
useDebouncedCallback doesn't consider its dependencies #420
Labels
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
Comments
Hey @fabn thanks for opening this issue, I really appreciate it |
antonioru
added
bug
Something isn't working
help wanted
Extra attention is needed
good first issue
Good for newcomers
labels
Nov 30, 2023
I tried various changes including this one but it seems to not fix the problem.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
Describe the bug
This is the same issue reported in #386 for useDebouncedCallback, I don't know why that issue has been closed. I'd expect that any dependency given as args will invalidate the callback but that's not the case because deps are not given to the
useEffect
call here. As result the callback sees the values as one step behind.To Reproduce
Here's a codesandbox to reproduce the issue https://codesandbox.io/p/sandbox/pedantic-grass-f9f6qw
Expected behavior
When I click on useDebouncedCallback button I should see same values as other buttons in console, but I see the old
counter
value.Screenshots
The text was updated successfully, but these errors were encountered: