Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mutate args for useSWRInfinite hook #1947

Merged
merged 8 commits into from May 14, 2022
6 changes: 5 additions & 1 deletion infinite/index.ts
Expand Up @@ -180,9 +180,13 @@ export const infinite = (<Data, Error>(useSWRNext: SWRHook) =>
]
) => {
const data = args[0]

// When passing as a boolean, it's explicitly used to disable/enable
// revalidation.
const options = typeof args[1] === 'boolean' ? {revalidate: args[1]} : args[1] || {}

// Default to true.
const shouldRevalidate = args[1] !== false
const shouldRevalidate = options.revalidate !== false

// It is possible that the key is still falsy.
if (!infiniteKey) return
Expand Down