Update Changelog

This commit is contained in:
Tanner Linsley 2019-12-08 19:35:55 -07:00
parent e0ad323bd8
commit 492ba8a4f9
3 changed files with 13 additions and 8 deletions

View File

@ -1,13 +1,13 @@
{ {
"dist/index.js": { "dist/index.js": {
"bundled": 100428, "bundled": 103166,
"minified": 47447, "minified": 48591,
"gzipped": 12335 "gzipped": 12715
}, },
"dist/index.es.js": { "dist/index.es.js": {
"bundled": 99612, "bundled": 102323,
"minified": 46722, "minified": 47841,
"gzipped": 12189, "gzipped": 12565,
"treeshaked": { "treeshaked": {
"rollup": { "rollup": {
"code": 80, "code": 80,

View File

@ -1,3 +1,7 @@
## 7.0.0-rc.5
- Fixed an issue where the exported `useAsyncDebounce` method would crash if its promise throw an error.
## 7.0.0-rc.4 ## 7.0.0-rc.4
- A maintenance release, purely intended to update the @latest tag (which was overwritten by a v6 publish) - A maintenance release, purely intended to update the @latest tag (which was overwritten by a v6 publish)

View File

@ -133,7 +133,7 @@ export function useMountedLayoutEffect(fn, deps) {
}, deps) }, deps)
} }
export default function useAsyncDebounce(defaultFn, defaultWait = 0) { export function useAsyncDebounce(defaultFn, defaultWait = 0) {
const debounceRef = React.useRef({}) const debounceRef = React.useRef({})
debounceRef.current.defaultFn = defaultFn debounceRef.current.defaultFn = defaultFn
debounceRef.current.defaultWait = defaultWait debounceRef.current.defaultWait = defaultWait
@ -144,8 +144,9 @@ export default function useAsyncDebounce(defaultFn, defaultWait = 0) {
wait = debounceRef.current.defaultWait wait = debounceRef.current.defaultWait
) => { ) => {
if (!debounceRef.current.promise) { if (!debounceRef.current.promise) {
debounceRef.current.promise = new Promise(resolve => { debounceRef.current.promise = new Promise((resolve, reject) => {
debounceRef.current.resolve = resolve debounceRef.current.resolve = resolve
debounceRef.current.reject = reject
}) })
} }