Skip to content

Commit 0663f5f

Browse files
committed
Improve readability of isDefer.
1 parent 561309b commit 0663f5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-async/src/useAsync.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const useAsyncFetch = (input, init, { defer, json, ...options } = {}) => {
166166
const accept = headers["Accept"] || headers["accept"] || (headers.get && headers.get("accept"))
167167
const doFetch = (input, init) => globalScope.fetch(input, init).then(parseResponse(accept, json))
168168
const isDefer =
169-
defer === true || (defer !== false && ~["POST", "PUT", "PATCH", "DELETE"].indexOf(method))
169+
typeof defer === "boolean" ? defer : ~["POST", "PUT", "PATCH", "DELETE"].indexOf(method)
170170
const fn = isDefer ? "deferFn" : "promiseFn"
171171
const identity = JSON.stringify({ input, init, fn })
172172
const state = useAsync({

0 commit comments

Comments
 (0)