antonioru / beautiful-react-hooks

πŸ”₯ A collection of beautiful and (hopefully) useful React hooks to speed-up your components and hooks development πŸ”₯
https://antonioru.github.io/beautiful-react-hooks/
MIT License
8.17k stars 577 forks source link

πŸ› Fix Bug In useDebouncedCallback Doesn't Consider Its Dependencies (#420) #426

Open baradoner opened 2 months ago

baradoner commented 2 months ago

πŸ› 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):

antonioru commented 1 month ago

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 commented 1 month ago

Done.

‫בΧͺΧΧ¨Χ™Χš יום Χ•Χ³, 30 באוג׳ 2024 Χ‘-17:26 מאΧͺ β€ͺRù‬‏ @.*** ‬‏>:‬

Amazing work, thank you!

@baradoner https://github.com/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?

β€” Reply to this email directly, view it on GitHub https://github.com/antonioru/beautiful-react-hooks/pull/426#issuecomment-2321431913, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCKGP5MGJF642PXIBJASMBLZUB6IJAVCNFSM6AAAAABLAT57YWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRRGQZTCOJRGM . You are receiving this because you were mentioned.Message ID: @.***>