swr breaking changes
Updated December 4, 2026
On this page
Latest version 2.5.1, released August 12, 2026.
Packages on npm run on Node.js. Node.js end of life dates.
- From 1.0.0 to 2.0.0: 27 breaking changes in 5 versions.
- From 0.5.0 to 2.0.0: 92 breaking changes in 10 versions.
swr 2.0.0 breaking changes
- Removed
infinite:InfiniteFetcher
Use SWRInfiniteFetcher instead. npmjs.com - Renamed
SWRConfig.default
Replace uses of SWRConfig.default with SWRConfig.defaultValue. github.com - Behavior changed
The build target changed to es2018, which may affect consumers targeting older environments. github.com - Behavior changed
useSWR
The fetcher receives arguments matching the key passed in, so fetcher functions that relied on the old argument shape must be updated. github.com - Behavior changed
useSWRMutation
Mutation errors are broadcast differently; use the new throwOnError option to control whether errors are thrown. github.com - Signature changed
Cache.get
Was get(key: Key): Data | null | undefined; now get(key: Key): State<Data> | undefined. npmjs.com - Signature changed
Cache.set
Was set(key: Key, value: Data): void; now set(key: Key, value: State<Data>): void. npmjs.com - Signature changed
Fetcher
Was type Fetcher<Data = unknown, SWRKey extends Key = Key> = SWRKey extends () => readonly [...infer Args] | null | undefined | false ? (...args: [...Args]) => FetcherResponse<Data> : SWRKey extends readonly [...infer Args] ? (...args... npmjs.com - Signature changed
immutable:default
Was const _default: import("swr").SWRHook; now const _default: swr.SWRHook. npmjs.com - Signature changed
infinite:SWRInfiniteFetcher
Was type SWRInfiniteFetcher<Data = any, KeyLoader extends SWRInfiniteKeyLoader = SWRInfiniteKeyLoader> = KeyLoader extends (...args: any[]) => any ? ReturnType<KeyLoader> extends readonly [...infer K] | null | false | undefined ? (...args... npmjs.com - Signature changed
infinite:SWRInfiniteKeyLoader
Was type SWRInfiniteKeyLoader = (index: number, previousPageData: any | null) => Arguments; now type SWRInfiniteKeyLoader<Data = any> = (index: number, previousPageData: Data | null) => Arguments. npmjs.com - Signature changed
infinite:SWRInfiniteResponse.data
Was data?: Data; now data: Data | undefined. npmjs.com - Signature changed
infinite:SWRInfiniteResponse.error
Was error?: Error; now error: Error | undefined. npmjs.com - Signature changed
Middleware
Was type Middleware = (useSWRNext: SWRHook) => <Data = any, Error = any>(key: Key, fetcher: BareFetcher<Data> | null, config: SWRConfiguration<Data, Error, BareFetcher<Data>>) => SWRResponse<Data, Error>; now type Middleware = (useSWRNext... npmjs.com - Signature changed
MutatorOptions
Was type MutatorOptions<Data = any> = {revalidate?: boolean; populateCache?: boolean | ((result: any, currentData: Data) => Data); optimisticData?: Data | ((currentData?: Data) => Data); rollbackOnError?: boolean;}; now type... npmjs.com - Signature changed
MutatorOptions.populateCache
Was populateCache?: boolean | ((result: any, currentData: Data) => Data); now populateCache?: boolean | ((result: any, currentData: Data | undefined) => Data). npmjs.com - Signature changed
MutatorOptions.rollbackOnError
Was rollbackOnError?: boolean; now rollbackOnError?: boolean | ((error: unknown) => boolean). npmjs.com - Signature changed
SWRConfig
Was const SWRConfig: import("react").FC<import("react").PropsWithChildren<{value?: (Partial<import("./types").PublicConfiguration<any, any, import("./types").BareFetcher<any>>> & Partial<import("./types").ProviderConfiguration> &... npmjs.com - Signature changed
SWRResponse.data
Was data?: Data; now data: Data | undefined. npmjs.com - Signature changed
SWRResponse.error
Was error?: Error; now error: Error | undefined. npmjs.com
swr 2.0.0-rc.0 breaking changes
- Behavior changed
useSWRMutation
A failed mutation no longer sets the error returned by useSWR; mutation errors are separate from fetcher errors. Handle mutation errors where the mutation is called. github.com - Default changed
useSWRMutation
trigger throws when a mutation fails unless throwOnError is set to false, so calls need try/catch or the new option. github.com
swr 2.0.0-beta.4 breaking changes
- Renamed
SWRConfig.default
Access SWR's default options via SWRConfig.defaultValue instead of SWRConfig.default. github.com
swr 2.0.0-beta.1 breaking changes
- Removed
InfiniteFetcher
The InfiniteFetcher type, deprecated in 1.x, is removed. Import SWRInfiniteFetcher from swr/infinite instead. github.com
swr 2.0.0-beta.0 breaking changes
- Behavior changed
cache.get
Direct cache reads now return an object instead of the raw data, so code using cache.get must read .data. Direct cache writes must wrap the data in an object. github.com - Behavior changed
cache.set
cache.set now needs an object holding the state fields rather than the bare data value. github.com - Signature changed
useSWR
When the key is an array, the fetcher now receives the key as a single argument rather than each element as a separate argument. Update fetchers that read multiple arguments. github.com
swr 1.0.0 breaking changes
- Removed
cache
cache was removed in swr 1.0.0 npmjs.com - Removed
Cache.clear
Cache.clear was removed in swr 1.0.0 npmjs.com - Removed
Cache.has
Cache.has was removed in swr 1.0.0 npmjs.com - Removed
Cache.keys
Cache.keys was removed in swr 1.0.0 npmjs.com - Removed
Cache.serializeKey
Cache.serializeKey was removed in swr 1.0.0 npmjs.com - Removed
Cache.subscribe
Cache.subscribe was removed in swr 1.0.0 npmjs.com - Removed
CacheInterface
Use Cache instead. npmjs.com - Removed
ConfigInterface
Use SWRConfiguration instead. npmjs.com - Removed
keyInterface
Use Key instead. npmjs.com - Removed
responseInterface
Use SWRResponse instead. npmjs.com
And 46 more in this version. Sign up to see every change
Older versions
5 older versions, each with its first changes. Sign up to see every change
Show 5 older versions
swr 1.0.0-beta.14 breaking changes
- Renamed
revalidateWhenStale
The revalidateWhenStale option was renamed, so existing references must be updated. github.com
swr 1.0.0-beta.13 breaking changes
- Removed
createCache
createCache was removed and a new useSWRConfig API was added in its place. github.com - Renamed
fallbackValues
The fallbackValues option was renamed to fallback. github.com
And 2 more in this version.
swr 1.0.0-beta.12 breaking changes
- Behavior changed
Middlewares now run in reversed order, which can change results for code that stacks them. github.com
swr 1.0.0-beta.9 breaking changes
- Removed
The legacy types were removed. Code that depends on them must be updated. github.com - Removed
The default fetcher was dropped, so a fetcher must now be provided explicitly. github.com
And 1 more in this version.
swr 0.5.0 breaking changes
- Renamed
onFocus
The onFocus and onReconnect names gained a register prefix in this release. Code that uses the old names must switch to the prefixed names. github.com - Renamed
onReconnect
The onFocus and onReconnect names gained a register prefix in this release. Code that uses the old names must switch to the prefixed names. github.com
And 60 more in this version.
Check your code
These are the changes. To see which of them reach your code, scan a public repository, or have your coding agent call check_code with your manifest or lockfile over MCP. The API reads every change in every version. A fix pull request opens for the changes that reach a connected repository. Nothing merges or deploys.

Put your code on continuous maintenance.
Scan a public repository now, or give your agent one line.
See how out of date your code is.
Tell your agent what changed since it was trained.
claude mcp add --transport http since https://api.since.dev/mcpCodex, Cursor and any MCP client use https://api.since.dev/mcp.