Packages

swr

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

Your version

1.1.0

30 Nov 2021Where it was published

1.3.0 is the newest release of 1.x.

In short

4 new

Release note

Highlights for This Release

1. Built-in & stable serialization for SWR keys

useSWR({ query: graphql`...`, variables }, fetcher)
useSWR({ query: graphql`...`, variables }, fetcher)
useSWR({ variables, query: graphql`...` }, fetcher)
// ^all recognized as the same resource

For array keys too, it's safe to do the following:

useSWR([ `...`, { variables } ], fetcher)

2. revalidateFirstPage for useSWRInfinite

This is a new added option for useSWRInfinite (defaults to true), you can use it to control if the first page should be revalidated when changing the size or doing a mutation.

3. Better TypeScript support

  • Key / arguments

  • Conditional / dependent

  • Constant keys

  • Returned data

image

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.