unstale

npm / swr

swr

What changed in swr 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-22.

2 new APIs and options6 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

swr 28 changes

New APIs and options 2

  • The experimental cacheData option enables preloading data in React Server Components and passing it to client hooks through SWRConfig, avoiding a duplicate initial browser request and hydrating the result into the SWR cache.

    2.5.0release notes

  • The new unload() API clears the entire SWR cache and discards in-flight requests and mutations. Mounted hooks revalidate by default, or pass { revalidate: false } to keep the cache empty until the next revalidation.

    2.5.0release notes

Fixes and other changes 6

  • Hooks without a fetcher now hydrate cacheData correctly.

    2.5.1release notes

  • Suspense cacheData is revalidated when a component remounts.

    2.5.1release notes

  • Completed subscription state is cleaned up.

    2.5.1release notes

  • Fixed the React Server export so it resolves correctly in the published package.

    2.5.0release notes

  • Double-unsubscribing no longer removes the wrong subscriber from the cache.

    2.4.2release notes

  • A resolved promise no longer suspends because of missing status.

    2.4.2release notes