Skip to content

更新日志

请访问 SWR release page 查看所有的历史版本。

1.1.0

发布于 Wed Dec 01 2021.

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

What's Changed

New Contributors

Full Changelog: https://github.com/vercel/swr/compare/1.0.1...1.1.0

1.1.0-beta.12

发布于 Fri Nov 26 2021.

Patches

  • Chore: rename major branch to main: #1664
  • Fix keyloader index and previousPageData type: #1669
  • Fix: Add defaults for SWRResponse: #1609

Credits

Huge thanks to @huozhi, @promer94, and @TakahiroHimi for helping!

1.1.0-beta.11

发布于 Wed Nov 24 2021.

Patches

  • Fix: supports ssr in ie11(#1657): #1659
  • Type: disbale inference when data generic is provided: #1658

Credits

Huge thanks to @Sh031224 and @promer94 for helping!

1.1.0-beta.10

发布于 Tue Nov 23 2021.

Minor Changes

  • Build: output without minification: #1650
  • Tweak types: #1640

Patches

  • Fix: typos: #1647

Credits

Huge thanks to @promer94, @huozhi, and @nguyenyou for helping!

1.1.0-beta.9

发布于 Thu Nov 11 2021.

Minor Changes

  • Revert "chore: Add type: "module" and use .mjs extension" (#1618): #1604

Patches

  • Enhance: bind removeEventListener: #1596

Credits

Huge thanks to @huozhi for helping!