Packages

swr

2.5.1 · 12 Aug 2026MIT28.9M / weekRepositoryHomepagenpmAtom feed

Your version

2.0.1

18 Jan 2023Where it was published

2.5.1 is the newest release of 2.x.

In short

1 new2 fixed8 changed1 internal

Release note

In this patch release, we majorly improved typing support and SWR can infer the types based on the configuration.

  • When the suspense option is true, the returned data will exclude undefined and the isLoading will always be false.

  • When the fallbackData option is provided, the returned data will be the same type of fallbackData, and the isLoading will always be false.

Here's a demo for it:

user-images.githubusercontent.com/4800338/21328…

What's Changed

  • types: Make FullConfiguration generic

  • type: Enforce array literal as tuple

  • Improve type test

  • Update bunchee to remove the extra target cli option

  • useSWRMutation should always use the latest fetcher

  • types: Conditional swr response

  • Types properites in exports fields

  • Update license year

  • Add all mutate options support to useSWRInfinite

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.