Skip to content

Commit

Permalink
check key as well when trigger the initial revalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
anothertempore committed Mar 2, 2021
1 parent c7d725f commit 269459b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/use-swr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function useSWR<Data = any, Error = any>(
}

const resolveIsValidating = () => {
return !!cache.get(keyValidating) || willRevalidateOnMount()
return !!cache.get(keyValidating) || (key && willRevalidateOnMount())
}

const initialData = resolveData()
Expand Down

0 comments on commit 269459b

Please sign in to comment.