Skip to content

Commit a4c7a4c

Browse files
Kent C. Doddsghengeveld
authored andcommitted
BUGFIX: Fix handleReject (#47)
* Fix handleReject By simply returning the error it changed the promise chain from rejected to resolved which was causing me issues. * prettier issue
1 parent 4255897 commit a4c7a4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/useAsync.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const useAsync = (arg1, arg2) => {
4444
const handleResolve = count => data =>
4545
count === counter.current && setData(data, () => onResolve && onResolve(data))
4646
const handleReject = count => error =>
47-
count === counter.current && setError(error, () => onReject && onReject(error))
47+
count === counter.current && Promise.reject(setError(error, () => onReject && onReject(error)))
4848

4949
const start = promiseFn => {
5050
if ("AbortController" in window) {

0 commit comments

Comments
 (0)