Skip to content

Releases: vercel/swr

v2.1.2

02 Apr 09:24
Compare
Choose a tag to compare

Patches

  • Improved type inferring for swr/subscription
  • Adding SWRSubscriptionOptions type for swr/subscription

Changes

  • test: add typing test for empty config by @koba04 in #2521
  • test: fix syntax error in Equal type alias implementation by @SACHINnANYAKKARA in #2517
  • chore: remove engines by @promer94 in #2536
  • types: improve useSWRSubscription types by @promer94 in #2535
  • Rename subscription types by @huozhi in #2537

New Contributors

  • @SACHINnANYAKKARA made their first contribution in #2517

Full Changelog: v2.1.1...v2.1.2

v2.1.1

22 Mar 14:54
Compare
Choose a tag to compare

Patches

  • refactor: remove useless dataRef, always compare cached data by @promer94 in #2431
  • fix: swr infers incorrect data type for default SWRConfig generic type by @connorch in #2506

Documentation

New Contributors

Full Changelog: v2.1.0...v2.1.1

v2.1.0

06 Mar 16:50
Compare
Choose a tag to compare

Feature

Checkout subscription docs and useSWRInfinite parallel fetching docs for more details

Patches

  • fix: use the latest config in useSWRMutation by @koba04 in #2468
  • Fix: type support for suspense and fallbackData(#2396) by @taro-28 in #2452
  • Error should be reset when new data comes by @huozhi in #2472
  • fix: avoid creating new snapshot if cache is not updated at client during streaming by @promer94 in #2475
  • refactor: initialize the cache only on first access by @promer94 in #2479

Misc

New Contributors

Full Changelog: v2.0.4...v2.1.0

v2.0.4

24 Feb 16:28
Compare
Choose a tag to compare

Patches

  • build: fix release job condition by @huozhi in #2392
  • types: fix some mutation type issue by @promer94 in #2421
  • fix: Error retry should be handled by global revalidator instead of local revalidation function by @promer94 in #2415
  • fix: ensure initCache setter function stays within bounds of subscriptions by @lfbergee in #2411

Misc

New Contributors

Full Changelog: v2.0.3...v2.0.4

v2.0.3

28 Jan 12:55
Compare
Choose a tag to compare

Patches

  • fix: parameters passed to subscribe is inconsistent with its declaration by @hong24 in #2353
  • fix: when inifinite key changes, should use cached pagesize instead of initialSize by @promer94 in #2386
  • fix: make compare function only compare data (#2375) by @Retrospection and @promer94 in #2387 #2389
  • fix: initial loading state should be false with revalidation is disabed by @promer94 in #2382
  • fix: Ensure hydration matches the SSR result during streaming by @shuding in #2391

Chores

New Contributors

Full Changelog: v2.0.2...v2.0.3

v2.0.2

26 Jan 13:06
c0090ab
Compare
Choose a tag to compare

Patches

Chores

Full Changelog: v2.0.1...v2.0.2

v2.0.1

18 Jan 17:36
Compare
Choose a tag to compare

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:

swr-2.0.1.mp4

What's Changed

New Contributors

Full Changelog: 2.0.0...v2.0.1

2.0.0

09 Dec 21:28
14956a8
Compare
Choose a tag to compare

Announcing SWR 2.0

We are excited to announce the release of SWR 2.0! The new version comes with a lot of improvements:

  • New useSWRMutation hook
  • Enhanced mutation and optimistic UI capabilities
  • SWR DevTools
  • Preload resource
  • Improved React 18 support

And more!

Read our blog post and migration guide: https://swr.vercel.app/blog/swr-v2

What's Changed

New Contributors

Read more

2.0.0-rc.3

28 Nov 15:41
f024b2f
Compare
Choose a tag to compare
2.0.0-rc.3 Pre-release
Pre-release

What's Changed

Full Changelog: 2.0.0-rc.1...2.0.0-rc.3

2.0.0-rc.1

25 Nov 16:30
f5f43b7
Compare
Choose a tag to compare
2.0.0-rc.1 Pre-release
Pre-release

The last RC before SWR 2.0. This release includes several small fixes with one breaking change.

Breaking

In this release, we are dropping IE 11 support, and using ES2018 as the build target. However, when using SWR in a framework or using a bundler (esbuild, Webpack, etc.), you can still target ES5 or using a browserlist configuration to customize this.

The benefit of this change is, we can now use faster native APIs to make SWR more performant, instead of using old alternatives. A benchmark shows a 4.7x speed improvement of the useSWR() function call during SSR, when we change Object.assign({}, a, b) to { ...a, ...b }.

Details can be found in #2249.

What's Changed

New Contributors

Full Changelog: 2.0.0-rc.0...2.0.0-rc.1