Skip to content

Releases: vercel/swr

1.1.2-beta.0

15 Dec 15:44
fd3a649
Compare
Choose a tag to compare
1.1.2-beta.0 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: 1.1.1...1.1.2-beta.0

1.1.1

10 Dec 16:06
b78937f
Compare
Choose a tag to compare

Highlights of This Release

Dynamic refreshInterval

You can now pass a function as refreshInterval, to dynamically return the interval (in millisecond) til the next request, based on the current data:

useSWR('key', fetcher, {
  refreshInterval: function (data: Data | undefined) {
    if (!data) return 3000 // Initial request 
    return data.next_update
  }
})

If return 0, polling will be stopped.

What's Changed

New Contributors

Full Changelog: 1.1.0...1.1.1

1.1.0

30 Nov 16:05
16778a7
Compare
Choose a tag to compare

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: 1.0.1...1.1.0

1.1.0-beta.12

26 Nov 15:14
b3e6e20
Compare
Choose a tag to compare
1.1.0-beta.12 Pre-release
Pre-release

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

24 Nov 15:11
72a5480
Compare
Choose a tag to compare
1.1.0-beta.11 Pre-release
Pre-release

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

23 Nov 15:12
bb0bd86
Compare
Choose a tag to compare
1.1.0-beta.10 Pre-release
Pre-release

Minor Changes

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

Patches

Credits

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

1.1.0-beta.9

11 Nov 10:37
98556e1
Compare
Choose a tag to compare
1.1.0-beta.9 Pre-release
Pre-release

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!

1.1.0-beta.8

01 Nov 18:04
37ba0e9
Compare
Choose a tag to compare
1.1.0-beta.8 Pre-release
Pre-release

Patches

  • Chore: Add type: "module" and use .mjs extension: #1604

1.1.0-beta.7

01 Nov 13:00
d618614
Compare
Choose a tag to compare
1.1.0-beta.7 Pre-release
Pre-release

Minor Changes

  • Fix: Support for functions that return false: #1586
  • Fix: adds undefined as valid Key type to allow falsy Key or Key(): #1594
  • Revert "mark data and error as readonly " (#1570): #1514

Patches

  • Fix react-native issue: #1583
  • Fix: compatible with miniprogram: #1595
  • Change config alteration process in withMiddleware to be immutable: #1556
  • Fix mutate argument for infinite: #1602

Credits

Huge thanks to @TakahiroHimi, @morgs32, @aFINKndreas, @zhaomengfan, and @junsushin-dev for helping!

1.1.0-beta.6

24 Oct 04:25
99ed33b
Compare
Choose a tag to compare
1.1.0-beta.6 Pre-release
Pre-release

Patches

  • Small fixes: #1541
  • Chore: Refactor cleanupState: #1544
  • Feat: using latest version of axios with fetch interceptor: #1548
  • Test: Add test case for mutation deduplication: #1549
  • Test: speed up with @swc-node/jest: #1569
  • Optimizations: #1578

Credits

Huge thanks to @danestves and @huozhi for helping!