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

feat: new hooks useDebouncedEffect and useDebouncedState #133

Merged
merged 1 commit into from
Jun 16, 2021

Conversation

xobotyi
Copy link
Contributor

@xobotyi xobotyi commented Jun 16, 2021

What new hook does?

  • useDebouncedEffect — Like useEffect, but passed function is debounced.
  • useDebouncedState — Lise useSafeState but its state setter is debounced.

Checklist

  • Have you read contribution guideline?
  • Does the code have comments in hard-to-understand areas?
  • Is there an existing issue for this PR?
    • link issue here
  • Have the files been linted and formatted?
  • Have the docs been updated?
  • Have the tests been added to cover new hook?
  • Have you run the tests locally to confirm they pass?

@xobotyi xobotyi added the 🎂 new hook New hook added label Jun 16, 2021
@xobotyi xobotyi requested a review from JoeDuncko June 16, 2021 14:13
@codecov
Copy link

codecov bot commented Jun 16, 2021

Codecov Report

Merging #133 (300d5e6) into master (021d02a) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master      #133    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           15        34    +19     
  Lines          111       555   +444     
  Branches        14       102    +88     
==========================================
+ Hits           111       555   +444     
Impacted Files Coverage Δ
src/useFirstMountState/useFirstMountState.ts 100.00% <ø> (ø)
src/useIsMounted/useIsMounted.ts 100.00% <ø> (ø)
src/useMountEffect/useMountEffect.ts 100.00% <ø> (ø)
src/usePrevious/usePrevious.ts 100.00% <ø> (ø)
src/useUnmountEffect/useUnmountEffect.ts 100.00% <ø> (ø)
src/index.ts 100.00% <100.00%> (ø)
src/useAsync/useAsync.ts 100.00% <100.00%> (ø)
src/useConditionalEffect/useConditionalEffect.ts 100.00% <100.00%> (ø)
...ditionalUpdateEffect/useConditionalUpdateEffect.ts 100.00% <100.00%> (ø)
src/useCookieValue/useCookieValue.ts 100.00% <100.00%> (ø)
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 131d98e...300d5e6. Read the comment docs.

README.md Outdated Show resolved Hide resolved
src/useDebouncedCallback/__docs__/example.stories.tsx Outdated Show resolved Hide resolved
src/useDebouncedEffect/__docs__/example.stories.tsx Outdated Show resolved Hide resolved
@xobotyi xobotyi merged commit 1d164ff into master Jun 16, 2021
@xobotyi xobotyi deleted the useDebouncedEffect branch June 16, 2021 15:29
github-actions bot pushed a commit that referenced this pull request Jun 16, 2021
# [3.0.0](v2.2.0...v3.0.0) (2021-06-16)

### Bug Fixes

* rename useThrottleCallback and useDebounceCallback ([#130](#130)) ([77f66d7](77f66d7)), closes [#129](#129)

### Features

* add `maxWait` parameter to `useDebouncedCallback` hook ([#131](#131)) ([600baa8](600baa8))
* change args for `useThrottledCallback` and `useDebouncedCallback` ([#132](#132)) ([131d98e](131d98e))
* new hooks `useDebouncedEffect` and `useDebouncedState` ([#133](#133)) ([1d164ff](1d164ff))

### BREAKING CHANGES

* `delay` and `deps` arguments are swapped position for
`useThrottledCallback` and `useDebouncedCallback` hooks to be aligned
with `useCallback` signature.
* `useDebounceCallback` renamed to `useDebouncedCallback`
`useThrottleCallback` renamed to `useThrottledCallback`
@xobotyi
Copy link
Contributor Author

xobotyi commented Jun 16, 2021

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants