Skip to content

Conversation

@baradoner
Copy link
Contributor

🐛 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
Contributor Author

baradoner commented Sep 1, 2024 via email

Update Version from 5.0.2 to 5.0.3
@mathieumousnier
Copy link

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

@baradoner
Copy link
Contributor Author

baradoner commented Nov 29, 2024 via email

@baradoner
Copy link
Contributor Author

baradoner commented Dec 2, 2024 via email

@antonioru antonioru merged commit 140e62c into antonioru:master Jul 17, 2025
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