Socket
Socket
Sign inDemoInstall

use-debounce

Package Overview
Dependencies
3
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install
Previous1345
8Next

8.0.1

Diff

Changelog

Source

8.0.1

  • update library exports section to make exports work correctly with jest@28
xnimorz
published 8.0.1-beta •

xnimorz
published 8.0.0 •

Changelog

Source

8.0.0

  • breaking change useDebounce changed its build system to microbundle. For now we have several entries:

index.js is for commonJS approach index.modern.js for esnext module system index.umd.js for UMD. All the files are in dist folder.

If you have any paths which have esm or lib, please, replace them to dist:

Before:

import useDebounceCallback from 'use-debounce/lib/useDebounceCallback';

After:

import { useDebounceCallback } from 'use-debounce';
  • Fixed issue with incorrect VSCode autocomplete https://github.com/xnimorz/use-debounce/issues/131 Thanks to @c-ehrlich for reporting
  • Fixed useDebounce behaviour with react-devtools tab when devtools have a component with useDebounce or useDebounceCallback opened. https://github.com/xnimorz/use-debounce/issues/129 Thanks to @alexniarchos for reporting
  • Fixed issue with leading: true https://github.com/xnimorz/use-debounce/issues/124 Thanks to @mntnoe for reporting
xnimorz
published 8.0.0-beta •

xnimorz
published 7.0.1 •

Changelog

Source

7.0.1

  • debounced object now is preserved for use-debounce between the renders. Thanks to @msharifi99 for reporting.
xnimorz
published 7.0.0 •

Changelog

Source

7.0.0

  • breaking change useDebounce hook changed isPending behavior from async reacting to the sync. Now isPending returns True as soon as the new value is sent to the hook.
  • Dev dependencies updated
xnimorz
published 6.0.1 •

Changelog

Source

6.0.1

  • Fixed useDebouncedCallback return type. Closed https://github.com/xnimorz/use-debounce/issues/103 thanks to @VanTanev
xnimorz
published 6.0.0 •

Changelog

Source

6.0.0

  • breaking change: removed callback field, instead of this useDebouncedCallback and useThrottledCallback returns a callable function: Old:

    const { callback, pending } = useDebouncedCallback(/*...*/);
    // ...
    debounced.callback();
    

    New:

    const debounced = useDebouncedCallback(/*...*/);
    // ...
    debounced();
    /**
     * Also debounced has fields:
     * {
     *   cancel: () => void
     *   flush: () => void
     *   isPending: () => boolean
     * }
     * So you can call debounced.cancel(), debounced.flush(), debounced.isPending()
     */
    

    It makes easier to understand which cancel \ flush or isPending is called in case you have several debounced functions in your component

  • breaking change: Now useDebounce, useDebouncedCallback and useThrottledCallback has isPending method instead of pending

    Old:

    const { callback, pending } = useDebouncedCallback(/*...*/);
    

    New:

    const { isPending } = useDebouncedCallback(/*...*/);
    /**
     * {
     *   cancel: () => void
     *   flush: () => void
     *   isPending: () => boolean
     * }
     */
    
  • get rid of useCallback calls

  • improve internal typing

  • decrease the amount of functions to initialize each useDebouncedCallback call

  • reduce library size:

    Whole library: from 946 B to 899 B === 47 B useDebounce: from 844 to 791 === 53 B useDebouncedCallback: from 680 to 623 === 57 B useThrottledCallback: from 736 to 680 === 56 B

xnimorz
published 6.0.0-beta •

xnimorz
published 5.2.1 •

Changelog

Source

5.2.1

  • prevent having ininite setTimeout setup when component gets unmounted https://github.com/xnimorz/use-debounce/issues/97
  • function type works correctly with useDebounce now. https://github.com/xnimorz/use-debounce/pull/95 Thanks to @csu-feizao
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc