swr
2.5.1 · 12 Aug 2026MIT28.9M / weekRepositoryHomepagenpmAtom feed
1.3.0 is the newest release of 1.x.
In short
4 new2 fixed5 changed
Release note
Highlights of This Release
Use the Latest Fetcher Function
SWR will now use the latest fetcher function passed to the hook, when sending the request. Previously it uses the initial snapshotted fetcher.
Avoid Unnecessary Auto Revalidations
When refocusing on the window with state changes (like clicking a button that changes the SWR key immediately), SWR now avoids revalidations if they're not necessary. Details can be found in #1720.
New Types for useSWRInfinite
Two types for useSWRInfinite are added: SWRInfinteHook and SWRInfinteKeyLoader. You can use them to type the hook and the getKey function.
New populateCache option for mutate
A new option to control if the mutation data should be written to the cache. You can find the details in #1729.
What's Changed
Make polyfill for
requestAnimationFramemore robusttype(infinite): export SWRInfinteHook and SWRInfiniteKeyLoader from infinite, rename InfiniteFetcher to SWRInfiniteFetcher
Ensure auto revalidations are executed after state updates
Add moduleNameMapper to jest
Improve test
Use the latest reference of fetcher
Re-export InfiniteFetcher
Add
populateCacheoption tomutateFix local state sharing example deps
Merge states for concurrent requests
Skip error retrying when document is not active and improve tests
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.