Skip to content

Commit

Permalink
feat(return) unset isLoading in cases not covered by tests (Kong#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivos committed Oct 16, 2022
1 parent 7d5f32f commit 274bbe7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/use-swrv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ function useSWRV<Data = any, Error = any> (...args): IResponse<Data, Error> {
(opts?.forceRevalidate !== undefined && !opts?.forceRevalidate)
) {
stateRef.isValidating = false
stateRef.isLoading = false
return
}

Expand All @@ -268,6 +269,7 @@ function useSWRV<Data = any, Error = any> (...args): IResponse<Data, Error> {

if (!shouldRevalidate) {
stateRef.isValidating = false
stateRef.isLoading = false
return
}
}
Expand All @@ -283,6 +285,7 @@ function useSWRV<Data = any, Error = any> (...args): IResponse<Data, Error> {
await mutate(keyVal, promiseFromCache.data, config.cache, ttl)
}
stateRef.isValidating = false
stateRef.isLoading = false
PROMISES_CACHE.delete(keyVal)
if (stateRef.error !== undefined) {
const shouldRetryOnError = config.shouldRetryOnError && (opts ? opts.shouldRetryOnError : true)
Expand Down

0 comments on commit 274bbe7

Please sign in to comment.