diff --git a/src/immutable/index.ts b/src/immutable/index.ts index 573eca3c3..3bad3caa7 100644 --- a/src/immutable/index.ts +++ b/src/immutable/index.ts @@ -4,11 +4,13 @@ import { withMiddleware } from '../_internal' export const immutable: Middleware = useSWRNext => (key, fetcher, config) => { // Always override all revalidate options. - config.revalidateOnFocus = false - config.revalidateIfStale = false - config.revalidateOnReconnect = false - config.refreshInterval = 0 - return useSWRNext(key, fetcher, config) + return useSWRNext(key, fetcher, { + ...config, + revalidateOnFocus: false, + revalidateIfStale: false, + revalidateOnReconnect: false, + refreshInterval: 0 + }) } const useSWRImmutable = withMiddleware(useSWR, immutable)