Skip to content
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

🐛 Fix Bug In useDebouncedCallback Doesn't Consider Its Dependencies (#420) #426

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

baradoner
Copy link

🐛 Fix Bug In useDebouncedCallback Doesn't Consider Its Dependencies (#420)

Description

This commit addresses an issue in the useDebouncedCallback hook where the dependencies were not properly taken into account. This bug caused the callback function to not update correctly when its dependencies changed. The fix ensures that the callback function is debounced and correctly re-evaluates its dependencies, improving the hook's reliability and performance.

Related Issue

useDebouncedCallback doesn't consider its dependencies #420

Motivation and Context

This change is required to ensure that the useDebouncedCallback hook functions as expected by properly considering its dependencies. Without this fix, users may encounter unexpected behavior where the callback does not update in response to changes in its dependencies, leading to potential bugs and inconsistencies in the application.

How Has This Been Tested?

Unit tests verified the callback re-evaluates its dependencies. All tests passed successfully.

Screenshots (if appropriate):

…ntonioru#420)

🐛 Fix bug in useDebouncedCallback where dependencies were not considered (antonioru#420)
@antonioru
Copy link
Owner

Amazing work, thank you!

@baradoner can you please update the version in the package.json from 5.0.2 to 5.0.3 so that it will automatically trigger a new release?

@baradoner
Copy link
Author

baradoner commented Sep 1, 2024 via email

Update Version from 5.0.2 to 5.0.3
@moooss
Copy link

moooss commented Nov 28, 2024

As useThrottleCallback works exactly the same way, wouldn't be the right place to do the same change over there also ?

@baradoner
Copy link
Author

baradoner commented Nov 29, 2024 via email

@baradoner
Copy link
Author

baradoner commented Dec 2, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants