Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Support IE11 #1463

Merged
merged 3 commits into from
Sep 15, 2021
Merged

fix: Support IE11 #1463

merged 3 commits into from
Sep 15, 2021

Conversation

amannn
Copy link
Contributor

@amannn amannn commented Sep 15, 2021

Closes #1453

addEventListener needs to be called from document in IE11. Otherwise you'll run into a Invalid calling object error.

I've tested the proposed changes in IE11 and couldn't find any other errors.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 15, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5656db8:

Sandbox Source
SWR-Basic Configuration
SWR-States Configuration
SWR-Infinite Configuration
SWR-SSR Configuration

@amannn amannn mentioned this pull request Sep 15, 2021
@shuding
Copy link
Member

shuding commented Sep 15, 2021

Thanks for the PR!

@shuding shuding merged commit 13b3db9 into vercel:master Sep 15, 2021
@shuding shuding mentioned this pull request Oct 14, 2021
kodiakhq bot referenced this pull request in vercel/turborepo Sep 8, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [swr](https://swr.vercel.app) ([source](https://togithub.com/vercel/swr)) | [`1.0.1` -> `1.3.0`](https://renovatebot.com/diffs/npm/swr/1.0.1/1.3.0) | [![age](https://badges.renovateapi.com/packages/npm/swr/1.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/swr/1.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/swr/1.3.0/compatibility-slim/1.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/swr/1.3.0/confidence-slim/1.0.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>vercel/swr</summary>

### [`v1.3.0`](https://togithub.com/vercel/swr/releases/tag/1.3.0)

[Compare Source](https://togithub.com/vercel/swr/compare/1.2.2...1.3.0)

#### What's Changed

-   type: fix type error on SWRConfig by [@&#8203;Himself65](https://togithub.com/Himself65) in [#&#8203;1913](https://togithub.com/vercel/swr/issues/1913)
-   chore: update React 18 dependencies by [@&#8203;shuding](https://togithub.com/shuding) in [#&#8203;1824](https://togithub.com/vercel/swr/issues/1824)
-   test: fix an act warning by [@&#8203;koba04](https://togithub.com/koba04) in [#&#8203;1888](https://togithub.com/vercel/swr/issues/1888)
-   feat: support functional optimisticData by [@&#8203;huozhi](https://togithub.com/huozhi) in [#&#8203;1861](https://togithub.com/vercel/swr/issues/1861)
-   bugfix: make suspense and revalidateIfStale work together by [@&#8203;simowe](https://togithub.com/simowe) in [#&#8203;1851](https://togithub.com/vercel/swr/issues/1851)

**Full Changelog**: vercel/swr@1.2.2...1.3.0

### [`v1.2.2`](https://togithub.com/vercel/swr/releases/tag/1.2.2)

[Compare Source](https://togithub.com/vercel/swr/compare/1.2.1...1.2.2)

#### Highlights of This Release

##### `populateCache` Option Now Supports Function

We added better Optimistic UI support in [v1.2.0](https://togithub.com/vercel/swr/releases/tag/1.2.0). However, what if your API is only returning a subset of the data (such as the mutated part), that can be populated into the cache? Usually, an extra revalidation after that mutation is needed. But now you can also use a function as `populateCache` to transform the mutate result into the full data:

```js
await mutate(addTodo(newTodo), {
  optimisticData: [...data, newTodo],
  rollbackOnError: true,
  populateCache: (addedTodo, currentData) => {
    // `addedTodo` is what the API returns. It's not
    // returning a list of all current todos but only
    // the new added one.
    // In this case, we can transform the mutate result
    // together with current data, into the new data
    // that can be updated.
    return [...currentData, addedTodo];
  },
  // Since the API already gives us the updated information,
  // we don't need to revalidate here.
  revalidate: false,
});
```

The new definition:

```ts
populateCache?: boolean | ((mutationResult: any, currentData: Data) => Data)
```

Here is a demo for it: https://codesandbox.io/s/swr-basic-forked-hi9svh

##### Bug Fixes

#### What's Changed

-   refactor: revalidateIfStale has an effect on updates, not only mounting by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1837](https://togithub.com/vercel/swr/pull/1837)
-   fix: reset stale unmountedRef in suspense by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1843](https://togithub.com/vercel/swr/pull/1843)
-   test: add a test for the behavior of revalidateOnMount when the key has been changed by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1847](https://togithub.com/vercel/swr/pull/1847)
-   feat: Support `populateCache` as a function by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1818](https://togithub.com/vercel/swr/pull/1818)

**Full Changelog**: vercel/swr@1.2.1...1.2.2

### [`v1.2.1`](https://togithub.com/vercel/swr/releases/tag/1.2.1)

[Compare Source](https://togithub.com/vercel/swr/compare/1.2.0...1.2.1)

#### Highlights of This Release

##### `shouldRetryOnError` accepts a function

Previously [`shouldRetryOnError`](https://swr.vercel.app/docs/error-handling#error-retry) is either true or false. Now it accepts a function that conditionally determines if SWR should retry. Here's a simple example:

```js
const fetcher = url => fetch(url).then(res => {
  // Fetcher throws if the response code is not 2xx.
  if (!res.ok) throw res
  return res.json()
})

useSWR(key, fetcher, {
  shouldRetryOnError: (error) => {
    // We skip retrying if the API is returning 404:
    if (error.status === 404) return false
    return true
  }
})
```

Thanks to [@&#8203;sairajchouhan](https://togithub.com/sairajchouhan) for contributing!

#### What's Changed

-   `shouldRetryOnError` accepts a function that can be used to conditionally stop retrying   by [@&#8203;sairajchouhan](https://togithub.com/sairajchouhan) in [https://github.com/vercel/swr/pull/1816](https://togithub.com/vercel/swr/pull/1816)
-   build(deps-dev): bump next from 12.0.8 to 12.0.9 by [@&#8203;dependabot](https://togithub.com/dependabot) in [https://github.com/vercel/swr/pull/1821](https://togithub.com/vercel/swr/pull/1821)
-   fix: useSWRInfinite revalidates with revalidateOnMount by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1830](https://togithub.com/vercel/swr/pull/1830)

#### New Contributors

-   [@&#8203;sairajchouhan](https://togithub.com/sairajchouhan) made their first contribution in [https://github.com/vercel/swr/pull/1816](https://togithub.com/vercel/swr/pull/1816)

**Full Changelog**: vercel/swr@1.2.0...1.2.1

### [`v1.2.0`](https://togithub.com/vercel/swr/releases/tag/1.2.0)

[Compare Source](https://togithub.com/vercel/swr/compare/1.1.2...1.2.0)

#### Highlights of This Release

##### Optimistic Updates with Auto Error Rollback

There are now some new options in `mutate`:

```js
mutate(patchUser(user), {
  optimisticData: user,
  populateCache: true,
  rollbackOnError: true,
  revalidate: true,
})
```

Here the cache will be immediately updated to `user`, the “optimistic value”. And then a request (remote mutation) is started via `patchUser(user)` and the response will be written to the cache. If that request fails, the original result will be rolled back safely so the optimistic value will be gone. And after all those finish, a revalidation will start to fetch the latest value.

This is extremely helpful for building the optimistic UI pattern.

You can do the same for the global `mutate`, just remember to pass the key. Also, the current `mutate` APIs stay unchanged so `mutate(data, false)` works the same.

Here's an example: https://codesandbox.io/s/swr-basic-forked-k5hps.

https://user-images.githubusercontent.com/3676859/151381238-f3aba769-91b6-4bfc-9285-df1b9ef51773.mp4

##### `.mjs` Support

SWR now has `.mjs` exported for bundlers that prefer this format.

This doesn’t break environments that don’t support `.mjs`. An alternative `.esm.js` and CJS bundle are also published.

You can read more about ES modules [here](https://2ality.com/2017/05/es-module-specifiers.html).

#### What's Changed

-   feat: Optimistic mutation with error rollback by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1745](https://togithub.com/vercel/swr/pull/1745)
-   fix: Required return type when mutating by [@&#8203;RKatarine](https://togithub.com/RKatarine) in [https://github.com/vercel/swr/pull/1772](https://togithub.com/vercel/swr/pull/1772)
-   fix: use the latest reference of fetcher with suspense mode by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1803](https://togithub.com/vercel/swr/pull/1803)
-   test: add delay for flaky focus test by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1762](https://togithub.com/vercel/swr/pull/1762)
-   test: remove flaky focus test case by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1793](https://togithub.com/vercel/swr/pull/1793)
-   test: use [@&#8203;swc/jest](https://togithub.com/swc/jest) by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1790](https://togithub.com/vercel/swr/pull/1790)
-   chore: Ignore coverage report by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1744](https://togithub.com/vercel/swr/pull/1744)
-   chore: Merge mutation states by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1748](https://togithub.com/vercel/swr/pull/1748)
-   chore: Rename CONCURRENT_REQUESTS to FETCH by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1749](https://togithub.com/vercel/swr/pull/1749)
-   chore: Merge extra request states in cache by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1752](https://togithub.com/vercel/swr/pull/1752)
-   chore: support mjs exports by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1760](https://togithub.com/vercel/swr/pull/1760)
-   chore: remove useless react-native field by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1761](https://togithub.com/vercel/swr/pull/1761)
-   chore: comment helper by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1757](https://togithub.com/vercel/swr/pull/1757)
-   chore: display name in devtool by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1779](https://togithub.com/vercel/swr/pull/1779)
-   chore: simplify example development by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1787](https://togithub.com/vercel/swr/pull/1787)
-   chore: build: improve watch commands by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1788](https://togithub.com/vercel/swr/pull/1788)
-   chore: Update examples and dependencies by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1789](https://togithub.com/vercel/swr/pull/1789)
-   chore: zeit -> vercel by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1791](https://togithub.com/vercel/swr/pull/1791)
-   chore: Clean up configurations by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1792](https://togithub.com/vercel/swr/pull/1792)
-   chore: move community health files to .github dir by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1794](https://togithub.com/vercel/swr/pull/1794)
-   chore: Add link to security email directly by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1795](https://togithub.com/vercel/swr/pull/1795)

#### New Contributors

-   [@&#8203;RKatarine](https://togithub.com/RKatarine) made their first contribution in [https://github.com/vercel/swr/pull/1772](https://togithub.com/vercel/swr/pull/1772)

**Full Changelog**: vercel/swr@1.1.2...1.2.0

### [`v1.1.2`](https://togithub.com/vercel/swr/releases/tag/1.1.2)

[Compare Source](https://togithub.com/vercel/swr/compare/1.1.1...1.1.2)

#### Highlights of This Release

##### Use the Latest Fetcher Function

SWR will now use the latest fetcher function passed to the hook, when sending the request. Previously it uses the initial snapshotted fetcher.

##### Avoid Unnecessary Auto Revalidations

When refocusing on the window with state changes (like clicking a button that changes the SWR key immediately), SWR now avoids revalidations if they're not necessary. Details can be found in [#&#8203;1720](https://togithub.com/vercel/swr/issues/1720).

##### New Types for `useSWRInfinite`

Two types for `useSWRInfinite` are added: `SWRInfinteHook` and `SWRInfinteKeyLoader`. You can use them to type the hook and the `getKey` function.

##### New `populateCache` option for `mutate`

A new option to control if the mutation data should be written to the cache. You can find the details in [#&#8203;1729](https://togithub.com/vercel/swr/issues/1729).

#### What's Changed

-   Make polyfill for `requestAnimationFrame` more robust by [@&#8203;thomaspaulmann](https://togithub.com/thomaspaulmann) in [https://github.com/vercel/swr/pull/1707](https://togithub.com/vercel/swr/pull/1707)
-   type(infinite): export SWRInfinteHook and SWRInfiniteKeyLoader from infinite, rename InfiniteFetcher to SWRInfiniteFetcher by [@&#8203;houkanshan](https://togithub.com/houkanshan) in [https://github.com/vercel/swr/pull/1714](https://togithub.com/vercel/swr/pull/1714)
-   feat: Ensure auto revalidations are executed after state updates by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1720](https://togithub.com/vercel/swr/pull/1720)
-   Add moduleNameMapper to jest by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1724](https://togithub.com/vercel/swr/pull/1724)
-   Improve test by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1725](https://togithub.com/vercel/swr/pull/1725)
-   feat: Use the latest reference of fetcher by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1727](https://togithub.com/vercel/swr/pull/1727)
-   fix: Re-export InfiniteFetcher by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1728](https://togithub.com/vercel/swr/pull/1728)
-   feat: Add `populateCache` option to `mutate` by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1729](https://togithub.com/vercel/swr/pull/1729)
-   Fix local state sharing example deps by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1737](https://togithub.com/vercel/swr/pull/1737)
-   Merge states for concurrent requests by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1741](https://togithub.com/vercel/swr/pull/1741)
-   Skip error retrying when document is not active and improve tests by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1742](https://togithub.com/vercel/swr/pull/1742)

#### New Contributors

-   [@&#8203;thomaspaulmann](https://togithub.com/thomaspaulmann) made their first contribution in [https://github.com/vercel/swr/pull/1707](https://togithub.com/vercel/swr/pull/1707)
-   [@&#8203;houkanshan](https://togithub.com/houkanshan) made their first contribution in [https://github.com/vercel/swr/pull/1714](https://togithub.com/vercel/swr/pull/1714)

**Full Changelog**: vercel/swr@1.1.1...1.1.2

### [`v1.1.1`](https://togithub.com/vercel/swr/releases/tag/1.1.1)

[Compare Source](https://togithub.com/vercel/swr/compare/1.1.0...1.1.1)

#### 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:

```typescript
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

-   feat: refreshInterval as a function by [@&#8203;Andrewnt219](https://togithub.com/Andrewnt219) in [https://github.com/vercel/swr/pull/1690](https://togithub.com/vercel/swr/pull/1690)
-   test: add refreshInterval function returns 0 by [@&#8203;Andrewnt219](https://togithub.com/Andrewnt219) in [https://github.com/vercel/swr/pull/1691](https://togithub.com/vercel/swr/pull/1691)
-   fix: If `newData` is deeply to the latest state, broadcast the latest state by [@&#8203;icyJoseph](https://togithub.com/icyJoseph) in [https://github.com/vercel/swr/pull/1697](https://togithub.com/vercel/swr/pull/1697)
-   fix: Return `undefined` data if key's falsy under suspense mode by [@&#8203;icyJoseph](https://togithub.com/icyJoseph) in [https://github.com/vercel/swr/pull/1698](https://togithub.com/vercel/swr/pull/1698)

#### New Contributors

-   [@&#8203;Andrewnt219](https://togithub.com/Andrewnt219) made their first contribution in [https://github.com/vercel/swr/pull/1690](https://togithub.com/vercel/swr/pull/1690)
-   [@&#8203;icyJoseph](https://togithub.com/icyJoseph) made their first contribution in [https://github.com/vercel/swr/pull/1697](https://togithub.com/vercel/swr/pull/1697)

**Full Changelog**: vercel/swr@1.1.0...1.1.1

### [`v1.1.0`](https://togithub.com/vercel/swr/releases/tag/1.1.0)

[Compare Source](https://togithub.com/vercel/swr/compare/1.0.1...1.1.0)

#### Highlights for This Release

##### 1. Built-in & stable serialization for SWR keys

```js
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:

```js
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](https://user-images.githubusercontent.com/3676859/144089090-f46f109a-e2bc-465f-8a75-f4932bc2d7dd.png)

#### What's Changed

-   Feature: make return state(data, error and isValidating) readonly by [@&#8203;anirudh1713](https://togithub.com/anirudh1713) in [https://github.com/vercel/swr/pull/1431](https://togithub.com/vercel/swr/pull/1431)
-   Stable hash by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1429](https://togithub.com/vercel/swr/pull/1429)
-   test: add render utilities and remove TestSWRConfig by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1435](https://togithub.com/vercel/swr/pull/1435)
-   Revert "Feature: make return state(data, error and isValidating) readonly" by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1443](https://togithub.com/vercel/swr/pull/1443)
-   Fix initial isValidating when isPaused() returns true by [@&#8203;anothertempore](https://togithub.com/anothertempore) in [https://github.com/vercel/swr/pull/1440](https://togithub.com/vercel/swr/pull/1440)
-   build: no emit on error by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1446](https://togithub.com/vercel/swr/pull/1446)
-   chore: remove unused typings by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1448](https://togithub.com/vercel/swr/pull/1448)
-   enhance: provider release handlers by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1449](https://togithub.com/vercel/swr/pull/1449)
-   test: refactor use-swr-cache-test by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1442](https://togithub.com/vercel/swr/pull/1442)
-   Chore: refactor code related to unsubscribing global listeners by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1451](https://togithub.com/vercel/swr/pull/1451)
-   Chore: code refactoring for swr/infinite by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1452](https://togithub.com/vercel/swr/pull/1452)
-   test: refactor concurrent rendering tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1457](https://togithub.com/vercel/swr/pull/1457)
-   test: refactor config tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1458](https://togithub.com/vercel/swr/pull/1458)
-   Revert "feat: add a warning for invalid arguments with suspense mode … by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1460](https://togithub.com/vercel/swr/pull/1460)
-   test: refactor mutation tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1459](https://togithub.com/vercel/swr/pull/1459)
-   fix: Support IE11 by [@&#8203;amannn](https://togithub.com/amannn) in [https://github.com/vercel/swr/pull/1463](https://togithub.com/vercel/swr/pull/1463)
-   test: refactor immutable and infinite hook tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1466](https://togithub.com/vercel/swr/pull/1466)
-   chore: Add React 18 to peerDependencies by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1467](https://togithub.com/vercel/swr/pull/1467)
-   test: refactor integration and loading tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1473](https://togithub.com/vercel/swr/pull/1473)
-   test: refactor key, middlewares, and suspense tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1474](https://togithub.com/vercel/swr/pull/1474)
-   test: refactor offline and refresh tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1483](https://togithub.com/vercel/swr/pull/1483)
-   build(deps): bump tmpl from 1.0.4 to 1.0.5 by [@&#8203;dependabot](https://togithub.com/dependabot) in [https://github.com/vercel/swr/pull/1484](https://togithub.com/vercel/swr/pull/1484)
-   Upgrade typescript to 4.4.3 by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1486](https://togithub.com/vercel/swr/pull/1486)
-   chore: Code refactoring by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1482](https://togithub.com/vercel/swr/pull/1482)
-   ci: multiple dir type checking by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1492](https://togithub.com/vercel/swr/pull/1492)
-   Type useSWR fetcher by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1477](https://togithub.com/vercel/swr/pull/1477)
-   chore: Improve project file structure by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1497](https://togithub.com/vercel/swr/pull/1497)
-   chore: Refine type interfaces by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1496](https://togithub.com/vercel/swr/pull/1496)
-   chore: Upgrade eslint and add local cache by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1499](https://togithub.com/vercel/swr/pull/1499)
-   fix: Invalidate the key when mutating without revalidating by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1498](https://togithub.com/vercel/swr/pull/1498)
-   example: add ref checking condition by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1504](https://togithub.com/vercel/swr/pull/1504)
-   fix: Refactor core revalidate function and fix isValidating state bug by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1493](https://togithub.com/vercel/swr/pull/1493)
-   chore: remove duplicate configs by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1507](https://togithub.com/vercel/swr/pull/1507)
-   typing: fix-type-generation by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1509](https://togithub.com/vercel/swr/pull/1509)
-   chroe: use yalc for local development by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1508](https://togithub.com/vercel/swr/pull/1508)
-   chore: Code refactoring by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1521](https://togithub.com/vercel/swr/pull/1521)
-   feat: Add new onDiscarded option by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1523](https://togithub.com/vercel/swr/pull/1523)
-   fix: Error events should be deduplicated by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1522](https://togithub.com/vercel/swr/pull/1522)
-   chore: Output test code coverage by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1511](https://togithub.com/vercel/swr/pull/1511)
-   chore: Mark returned states and mutate callback argument as readonly by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1514](https://togithub.com/vercel/swr/pull/1514)
-   test: Add tests for reconnect and merge-config by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1530](https://togithub.com/vercel/swr/pull/1530)
-   fix: Only trigger the success event if not discarded by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1529](https://togithub.com/vercel/swr/pull/1529)
-   chore: Code refactoring by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1533](https://togithub.com/vercel/swr/pull/1533)
-   Add revalidateFirstPage option to swr/infinite ([#&#8203;1401](https://togithub.com/vercel/swr/issues/1401)) by [@&#8203;timas130](https://togithub.com/timas130) in [https://github.com/vercel/swr/pull/1538](https://togithub.com/vercel/swr/pull/1538)
-   fix: Reusing cache provider by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1539](https://togithub.com/vercel/swr/pull/1539)
-   chore: fix ts comments by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1540](https://togithub.com/vercel/swr/pull/1540)
-   fix: Ensure mutate accepts undefined as the data by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1515](https://togithub.com/vercel/swr/pull/1515)
-   chore: Fix comment and startAt type by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1541](https://togithub.com/vercel/swr/pull/1541)
-   chore: Refactor cleanupState by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1544](https://togithub.com/vercel/swr/pull/1544)
-   feat: using latest version of `axios` with fetch interceptor by [@&#8203;danestves](https://togithub.com/danestves) in [https://github.com/vercel/swr/pull/1548](https://togithub.com/vercel/swr/pull/1548)
-   test: Add test case for mutation deduplication by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1549](https://togithub.com/vercel/swr/pull/1549)
-   test: speed up with [@&#8203;swc-node/jest](https://togithub.com/swc-node/jest) by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1569](https://togithub.com/vercel/swr/pull/1569)
-   chore: Optimizations by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1578](https://togithub.com/vercel/swr/pull/1578)
-   fix react-native issue by [@&#8203;aFINKndreas](https://togithub.com/aFINKndreas) in [https://github.com/vercel/swr/pull/1583](https://togithub.com/vercel/swr/pull/1583)
-   fix: Support for functions that return false by [@&#8203;TakahiroHimi](https://togithub.com/TakahiroHimi) in [https://github.com/vercel/swr/pull/1586](https://togithub.com/vercel/swr/pull/1586)
-   fix: adds undefined as valid Key type to allow falsy Key or Key() by [@&#8203;morgs32](https://togithub.com/morgs32) in [https://github.com/vercel/swr/pull/1594](https://togithub.com/vercel/swr/pull/1594)
-   fix: can't find variable removeEventListener by [@&#8203;zhaomengfan](https://togithub.com/zhaomengfan) in [https://github.com/vercel/swr/pull/1595](https://togithub.com/vercel/swr/pull/1595)
-   Revert "chore: Mark returned states and mutate callback argument as readonly" by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1570](https://togithub.com/vercel/swr/pull/1570)
-   fix: change config alteration process in withMiddleware to be immutable by [@&#8203;junsushin-dev](https://togithub.com/junsushin-dev) in [https://github.com/vercel/swr/pull/1556](https://togithub.com/vercel/swr/pull/1556)
-   fix: Allow empty mutate argument list for infinite by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1602](https://togithub.com/vercel/swr/pull/1602)
-   chore: Add `type: "module"` and use `.mjs` extension by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1604](https://togithub.com/vercel/swr/pull/1604)
-   Revert "chore: Add type: "module" and use .mjs extension ([#&#8203;1604](https://togithub.com/vercel/swr/issues/1604))" by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1618](https://togithub.com/vercel/swr/pull/1618)
-   enhance: bind removeEventListener by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1596](https://togithub.com/vercel/swr/pull/1596)
-   fix: typos by [@&#8203;nguyenyou](https://togithub.com/nguyenyou) in [https://github.com/vercel/swr/pull/1647](https://togithub.com/vercel/swr/pull/1647)
-   build: output without minification by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1650](https://togithub.com/vercel/swr/pull/1650)
-   Tweak types by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1640](https://togithub.com/vercel/swr/pull/1640)
-   fix: supports ssr in ie11([#&#8203;1657](https://togithub.com/vercel/swr/issues/1657)) by [@&#8203;Sh031224](https://togithub.com/Sh031224) in [https://github.com/vercel/swr/pull/1659](https://togithub.com/vercel/swr/pull/1659)
-   type: disbale inference when data generic is provided by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1658](https://togithub.com/vercel/swr/pull/1658)
-   chore: rename major branch to main by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1664](https://togithub.com/vercel/swr/pull/1664)
-   fix keyloader index and previousPageData type by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1669](https://togithub.com/vercel/swr/pull/1669)
-   Add defaults for SWRResponse by [@&#8203;TakahiroHimi](https://togithub.com/TakahiroHimi) in [https://github.com/vercel/swr/pull/1609](https://togithub.com/vercel/swr/pull/1609)
-   example: update typescript examples with strict ts mode by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1673](https://togithub.com/vercel/swr/pull/1673)
-   chore: upgrade eslint to v8 and prettier to v2 by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1674](https://togithub.com/vercel/swr/pull/1674)
-   fix: remove unnecessary async by [@&#8203;Cut0](https://togithub.com/Cut0) in [https://github.com/vercel/swr/pull/1676](https://togithub.com/vercel/swr/pull/1676)
-   types: remove duplicated typing def by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1675](https://togithub.com/vercel/swr/pull/1675)
-   chore: Add test case for `getKey` in `useSWRInfinite` by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1681](https://togithub.com/vercel/swr/pull/1681)

#### New Contributors

-   [@&#8203;willheslam](https://togithub.com/willheslam) made their first contribution in [https://github.com/vercel/swr/pull/1393](https://togithub.com/vercel/swr/pull/1393)
-   [@&#8203;louisgv](https://togithub.com/louisgv) made their first contribution in [https://github.com/vercel/swr/pull/1406](https://togithub.com/vercel/swr/pull/1406)
-   [@&#8203;origin-master](https://togithub.com/origin-master) made their first contribution in [https://github.com/vercel/swr/pull/1409](https://togithub.com/vercel/swr/pull/1409)
-   [@&#8203;anirudh1713](https://togithub.com/anirudh1713) made their first contribution in [https://github.com/vercel/swr/pull/1431](https://togithub.com/vercel/swr/pull/1431)
-   [@&#8203;amannn](https://togithub.com/amannn) made their first contribution in [https://github.com/vercel/swr/pull/1463](https://togithub.com/vercel/swr/pull/1463)
-   [@&#8203;timas130](https://togithub.com/timas130) made their first contribution in [https://github.com/vercel/swr/pull/1538](https://togithub.com/vercel/swr/pull/1538)
-   [@&#8203;danestves](https://togithub.com/danestves) made their first contribution in [https://github.com/vercel/swr/pull/1548](https://togithub.com/vercel/swr/pull/1548)
-   [@&#8203;aFINKndreas](https://togithub.com/aFINKndreas) made their first contribution in [https://github.com/vercel/swr/pull/1583](https://togithub.com/vercel/swr/pull/1583)
-   [@&#8203;TakahiroHimi](https://togithub.com/TakahiroHimi) made their first contribution in [https://github.com/vercel/swr/pull/1586](https://togithub.com/vercel/swr/pull/1586)
-   [@&#8203;zhaomengfan](https://togithub.com/zhaomengfan) made their first contribution in [https://github.com/vercel/swr/pull/1595](https://togithub.com/vercel/swr/pull/1595)
-   [@&#8203;junsushin-dev](https://togithub.com/junsushin-dev) made their first contribution in [https://github.com/vercel/swr/pull/1556](https://togithub.com/vercel/swr/pull/1556)
-   [@&#8203;nguyenyou](https://togithub.com/nguyenyou) made their first contribution in [https://github.com/vercel/swr/pull/1647](https://togithub.com/vercel/swr/pull/1647)
-   [@&#8203;Sh031224](https://togithub.com/Sh031224) made their first contribution in [https://github.com/vercel/swr/pull/1659](https://togithub.com/vercel/swr/pull/1659)
-   [@&#8203;Cut0](https://togithub.com/Cut0) made their first contribution in [https://github.com/vercel/swr/pull/1676](https://togithub.com/vercel/swr/pull/1676)

**Full Changelog**: vercel/swr@1.0.1...1.1.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/vercel/turborepo).
dutterbutter referenced this pull request in dutterbutter/docs-turbo Nov 1, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [swr](https://swr.vercel.app) ([source](https://togithub.com/vercel/swr)) | [`1.0.1` -> `1.3.0`](https://renovatebot.com/diffs/npm/swr/1.0.1/1.3.0) | [![age](https://badges.renovateapi.com/packages/npm/swr/1.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/swr/1.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/swr/1.3.0/compatibility-slim/1.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/swr/1.3.0/confidence-slim/1.0.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>vercel/swr</summary>

### [`v1.3.0`](https://togithub.com/vercel/swr/releases/tag/1.3.0)

[Compare Source](https://togithub.com/vercel/swr/compare/1.2.2...1.3.0)

#### What's Changed

-   type: fix type error on SWRConfig by [@&#8203;Himself65](https://togithub.com/Himself65) in [#&#8203;1913](https://togithub.com/vercel/swr/issues/1913)
-   chore: update React 18 dependencies by [@&#8203;shuding](https://togithub.com/shuding) in [#&#8203;1824](https://togithub.com/vercel/swr/issues/1824)
-   test: fix an act warning by [@&#8203;koba04](https://togithub.com/koba04) in [#&#8203;1888](https://togithub.com/vercel/swr/issues/1888)
-   feat: support functional optimisticData by [@&#8203;huozhi](https://togithub.com/huozhi) in [#&#8203;1861](https://togithub.com/vercel/swr/issues/1861)
-   bugfix: make suspense and revalidateIfStale work together by [@&#8203;simowe](https://togithub.com/simowe) in [#&#8203;1851](https://togithub.com/vercel/swr/issues/1851)

**Full Changelog**: vercel/swr@1.2.2...1.3.0

### [`v1.2.2`](https://togithub.com/vercel/swr/releases/tag/1.2.2)

[Compare Source](https://togithub.com/vercel/swr/compare/1.2.1...1.2.2)

#### Highlights of This Release

##### `populateCache` Option Now Supports Function

We added better Optimistic UI support in [v1.2.0](https://togithub.com/vercel/swr/releases/tag/1.2.0). However, what if your API is only returning a subset of the data (such as the mutated part), that can be populated into the cache? Usually, an extra revalidation after that mutation is needed. But now you can also use a function as `populateCache` to transform the mutate result into the full data:

```js
await mutate(addTodo(newTodo), {
  optimisticData: [...data, newTodo],
  rollbackOnError: true,
  populateCache: (addedTodo, currentData) => {
    // `addedTodo` is what the API returns. It's not
    // returning a list of all current todos but only
    // the new added one.
    // In this case, we can transform the mutate result
    // together with current data, into the new data
    // that can be updated.
    return [...currentData, addedTodo];
  },
  // Since the API already gives us the updated information,
  // we don't need to revalidate here.
  revalidate: false,
});
```

The new definition:

```ts
populateCache?: boolean | ((mutationResult: any, currentData: Data) => Data)
```

Here is a demo for it: https://codesandbox.io/s/swr-basic-forked-hi9svh

##### Bug Fixes

#### What's Changed

-   refactor: revalidateIfStale has an effect on updates, not only mounting by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1837](https://togithub.com/vercel/swr/pull/1837)
-   fix: reset stale unmountedRef in suspense by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1843](https://togithub.com/vercel/swr/pull/1843)
-   test: add a test for the behavior of revalidateOnMount when the key has been changed by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1847](https://togithub.com/vercel/swr/pull/1847)
-   feat: Support `populateCache` as a function by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1818](https://togithub.com/vercel/swr/pull/1818)

**Full Changelog**: vercel/swr@1.2.1...1.2.2

### [`v1.2.1`](https://togithub.com/vercel/swr/releases/tag/1.2.1)

[Compare Source](https://togithub.com/vercel/swr/compare/1.2.0...1.2.1)

#### Highlights of This Release

##### `shouldRetryOnError` accepts a function

Previously [`shouldRetryOnError`](https://swr.vercel.app/docs/error-handling#error-retry) is either true or false. Now it accepts a function that conditionally determines if SWR should retry. Here's a simple example:

```js
const fetcher = url => fetch(url).then(res => {
  // Fetcher throws if the response code is not 2xx.
  if (!res.ok) throw res
  return res.json()
})

useSWR(key, fetcher, {
  shouldRetryOnError: (error) => {
    // We skip retrying if the API is returning 404:
    if (error.status === 404) return false
    return true
  }
})
```

Thanks to [@&#8203;sairajchouhan](https://togithub.com/sairajchouhan) for contributing!

#### What's Changed

-   `shouldRetryOnError` accepts a function that can be used to conditionally stop retrying   by [@&#8203;sairajchouhan](https://togithub.com/sairajchouhan) in [https://github.com/vercel/swr/pull/1816](https://togithub.com/vercel/swr/pull/1816)
-   build(deps-dev): bump next from 12.0.8 to 12.0.9 by [@&#8203;dependabot](https://togithub.com/dependabot) in [https://github.com/vercel/swr/pull/1821](https://togithub.com/vercel/swr/pull/1821)
-   fix: useSWRInfinite revalidates with revalidateOnMount by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1830](https://togithub.com/vercel/swr/pull/1830)

#### New Contributors

-   [@&#8203;sairajchouhan](https://togithub.com/sairajchouhan) made their first contribution in [https://github.com/vercel/swr/pull/1816](https://togithub.com/vercel/swr/pull/1816)

**Full Changelog**: vercel/swr@1.2.0...1.2.1

### [`v1.2.0`](https://togithub.com/vercel/swr/releases/tag/1.2.0)

[Compare Source](https://togithub.com/vercel/swr/compare/1.1.2...1.2.0)

#### Highlights of This Release

##### Optimistic Updates with Auto Error Rollback

There are now some new options in `mutate`:

```js
mutate(patchUser(user), {
  optimisticData: user,
  populateCache: true,
  rollbackOnError: true,
  revalidate: true,
})
```

Here the cache will be immediately updated to `user`, the “optimistic value”. And then a request (remote mutation) is started via `patchUser(user)` and the response will be written to the cache. If that request fails, the original result will be rolled back safely so the optimistic value will be gone. And after all those finish, a revalidation will start to fetch the latest value.

This is extremely helpful for building the optimistic UI pattern.

You can do the same for the global `mutate`, just remember to pass the key. Also, the current `mutate` APIs stay unchanged so `mutate(data, false)` works the same.

Here's an example: https://codesandbox.io/s/swr-basic-forked-k5hps.

https://user-images.githubusercontent.com/3676859/151381238-f3aba769-91b6-4bfc-9285-df1b9ef51773.mp4

##### `.mjs` Support

SWR now has `.mjs` exported for bundlers that prefer this format.

This doesn’t break environments that don’t support `.mjs`. An alternative `.esm.js` and CJS bundle are also published.

You can read more about ES modules [here](https://2ality.com/2017/05/es-module-specifiers.html).

#### What's Changed

-   feat: Optimistic mutation with error rollback by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1745](https://togithub.com/vercel/swr/pull/1745)
-   fix: Required return type when mutating by [@&#8203;RKatarine](https://togithub.com/RKatarine) in [https://github.com/vercel/swr/pull/1772](https://togithub.com/vercel/swr/pull/1772)
-   fix: use the latest reference of fetcher with suspense mode by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1803](https://togithub.com/vercel/swr/pull/1803)
-   test: add delay for flaky focus test by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1762](https://togithub.com/vercel/swr/pull/1762)
-   test: remove flaky focus test case by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1793](https://togithub.com/vercel/swr/pull/1793)
-   test: use [@&#8203;swc/jest](https://togithub.com/swc/jest) by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1790](https://togithub.com/vercel/swr/pull/1790)
-   chore: Ignore coverage report by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1744](https://togithub.com/vercel/swr/pull/1744)
-   chore: Merge mutation states by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1748](https://togithub.com/vercel/swr/pull/1748)
-   chore: Rename CONCURRENT_REQUESTS to FETCH by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1749](https://togithub.com/vercel/swr/pull/1749)
-   chore: Merge extra request states in cache by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1752](https://togithub.com/vercel/swr/pull/1752)
-   chore: support mjs exports by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1760](https://togithub.com/vercel/swr/pull/1760)
-   chore: remove useless react-native field by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1761](https://togithub.com/vercel/swr/pull/1761)
-   chore: comment helper by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1757](https://togithub.com/vercel/swr/pull/1757)
-   chore: display name in devtool by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1779](https://togithub.com/vercel/swr/pull/1779)
-   chore: simplify example development by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1787](https://togithub.com/vercel/swr/pull/1787)
-   chore: build: improve watch commands by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1788](https://togithub.com/vercel/swr/pull/1788)
-   chore: Update examples and dependencies by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1789](https://togithub.com/vercel/swr/pull/1789)
-   chore: zeit -> vercel by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1791](https://togithub.com/vercel/swr/pull/1791)
-   chore: Clean up configurations by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1792](https://togithub.com/vercel/swr/pull/1792)
-   chore: move community health files to .github dir by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1794](https://togithub.com/vercel/swr/pull/1794)
-   chore: Add link to security email directly by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1795](https://togithub.com/vercel/swr/pull/1795)

#### New Contributors

-   [@&#8203;RKatarine](https://togithub.com/RKatarine) made their first contribution in [https://github.com/vercel/swr/pull/1772](https://togithub.com/vercel/swr/pull/1772)

**Full Changelog**: vercel/swr@1.1.2...1.2.0

### [`v1.1.2`](https://togithub.com/vercel/swr/releases/tag/1.1.2)

[Compare Source](https://togithub.com/vercel/swr/compare/1.1.1...1.1.2)

#### Highlights of This Release

##### Use the Latest Fetcher Function

SWR will now use the latest fetcher function passed to the hook, when sending the request. Previously it uses the initial snapshotted fetcher.

##### Avoid Unnecessary Auto Revalidations

When refocusing on the window with state changes (like clicking a button that changes the SWR key immediately), SWR now avoids revalidations if they're not necessary. Details can be found in [#&#8203;1720](https://togithub.com/vercel/swr/issues/1720).

##### New Types for `useSWRInfinite`

Two types for `useSWRInfinite` are added: `SWRInfinteHook` and `SWRInfinteKeyLoader`. You can use them to type the hook and the `getKey` function.

##### New `populateCache` option for `mutate`

A new option to control if the mutation data should be written to the cache. You can find the details in [#&#8203;1729](https://togithub.com/vercel/swr/issues/1729).

#### What's Changed

-   Make polyfill for `requestAnimationFrame` more robust by [@&#8203;thomaspaulmann](https://togithub.com/thomaspaulmann) in [https://github.com/vercel/swr/pull/1707](https://togithub.com/vercel/swr/pull/1707)
-   type(infinite): export SWRInfinteHook and SWRInfiniteKeyLoader from infinite, rename InfiniteFetcher to SWRInfiniteFetcher by [@&#8203;houkanshan](https://togithub.com/houkanshan) in [https://github.com/vercel/swr/pull/1714](https://togithub.com/vercel/swr/pull/1714)
-   feat: Ensure auto revalidations are executed after state updates by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1720](https://togithub.com/vercel/swr/pull/1720)
-   Add moduleNameMapper to jest by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1724](https://togithub.com/vercel/swr/pull/1724)
-   Improve test by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1725](https://togithub.com/vercel/swr/pull/1725)
-   feat: Use the latest reference of fetcher by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1727](https://togithub.com/vercel/swr/pull/1727)
-   fix: Re-export InfiniteFetcher by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1728](https://togithub.com/vercel/swr/pull/1728)
-   feat: Add `populateCache` option to `mutate` by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1729](https://togithub.com/vercel/swr/pull/1729)
-   Fix local state sharing example deps by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1737](https://togithub.com/vercel/swr/pull/1737)
-   Merge states for concurrent requests by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1741](https://togithub.com/vercel/swr/pull/1741)
-   Skip error retrying when document is not active and improve tests by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1742](https://togithub.com/vercel/swr/pull/1742)

#### New Contributors

-   [@&#8203;thomaspaulmann](https://togithub.com/thomaspaulmann) made their first contribution in [https://github.com/vercel/swr/pull/1707](https://togithub.com/vercel/swr/pull/1707)
-   [@&#8203;houkanshan](https://togithub.com/houkanshan) made their first contribution in [https://github.com/vercel/swr/pull/1714](https://togithub.com/vercel/swr/pull/1714)

**Full Changelog**: vercel/swr@1.1.1...1.1.2

### [`v1.1.1`](https://togithub.com/vercel/swr/releases/tag/1.1.1)

[Compare Source](https://togithub.com/vercel/swr/compare/1.1.0...1.1.1)

#### 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:

```typescript
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

-   feat: refreshInterval as a function by [@&#8203;Andrewnt219](https://togithub.com/Andrewnt219) in [https://github.com/vercel/swr/pull/1690](https://togithub.com/vercel/swr/pull/1690)
-   test: add refreshInterval function returns 0 by [@&#8203;Andrewnt219](https://togithub.com/Andrewnt219) in [https://github.com/vercel/swr/pull/1691](https://togithub.com/vercel/swr/pull/1691)
-   fix: If `newData` is deeply to the latest state, broadcast the latest state by [@&#8203;icyJoseph](https://togithub.com/icyJoseph) in [https://github.com/vercel/swr/pull/1697](https://togithub.com/vercel/swr/pull/1697)
-   fix: Return `undefined` data if key's falsy under suspense mode by [@&#8203;icyJoseph](https://togithub.com/icyJoseph) in [https://github.com/vercel/swr/pull/1698](https://togithub.com/vercel/swr/pull/1698)

#### New Contributors

-   [@&#8203;Andrewnt219](https://togithub.com/Andrewnt219) made their first contribution in [https://github.com/vercel/swr/pull/1690](https://togithub.com/vercel/swr/pull/1690)
-   [@&#8203;icyJoseph](https://togithub.com/icyJoseph) made their first contribution in [https://github.com/vercel/swr/pull/1697](https://togithub.com/vercel/swr/pull/1697)

**Full Changelog**: vercel/swr@1.1.0...1.1.1

### [`v1.1.0`](https://togithub.com/vercel/swr/releases/tag/1.1.0)

[Compare Source](https://togithub.com/vercel/swr/compare/1.0.1...1.1.0)

#### Highlights for This Release

##### 1. Built-in & stable serialization for SWR keys

```js
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:

```js
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](https://user-images.githubusercontent.com/3676859/144089090-f46f109a-e2bc-465f-8a75-f4932bc2d7dd.png)

#### What's Changed

-   Feature: make return state(data, error and isValidating) readonly by [@&#8203;anirudh1713](https://togithub.com/anirudh1713) in [https://github.com/vercel/swr/pull/1431](https://togithub.com/vercel/swr/pull/1431)
-   Stable hash by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1429](https://togithub.com/vercel/swr/pull/1429)
-   test: add render utilities and remove TestSWRConfig by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1435](https://togithub.com/vercel/swr/pull/1435)
-   Revert "Feature: make return state(data, error and isValidating) readonly" by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1443](https://togithub.com/vercel/swr/pull/1443)
-   Fix initial isValidating when isPaused() returns true by [@&#8203;anothertempore](https://togithub.com/anothertempore) in [https://github.com/vercel/swr/pull/1440](https://togithub.com/vercel/swr/pull/1440)
-   build: no emit on error by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1446](https://togithub.com/vercel/swr/pull/1446)
-   chore: remove unused typings by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1448](https://togithub.com/vercel/swr/pull/1448)
-   enhance: provider release handlers by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1449](https://togithub.com/vercel/swr/pull/1449)
-   test: refactor use-swr-cache-test by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1442](https://togithub.com/vercel/swr/pull/1442)
-   Chore: refactor code related to unsubscribing global listeners by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1451](https://togithub.com/vercel/swr/pull/1451)
-   Chore: code refactoring for swr/infinite by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1452](https://togithub.com/vercel/swr/pull/1452)
-   test: refactor concurrent rendering tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1457](https://togithub.com/vercel/swr/pull/1457)
-   test: refactor config tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1458](https://togithub.com/vercel/swr/pull/1458)
-   Revert "feat: add a warning for invalid arguments with suspense mode … by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1460](https://togithub.com/vercel/swr/pull/1460)
-   test: refactor mutation tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1459](https://togithub.com/vercel/swr/pull/1459)
-   fix: Support IE11 by [@&#8203;amannn](https://togithub.com/amannn) in [https://github.com/vercel/swr/pull/1463](https://togithub.com/vercel/swr/pull/1463)
-   test: refactor immutable and infinite hook tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1466](https://togithub.com/vercel/swr/pull/1466)
-   chore: Add React 18 to peerDependencies by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1467](https://togithub.com/vercel/swr/pull/1467)
-   test: refactor integration and loading tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1473](https://togithub.com/vercel/swr/pull/1473)
-   test: refactor key, middlewares, and suspense tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1474](https://togithub.com/vercel/swr/pull/1474)
-   test: refactor offline and refresh tests by [@&#8203;koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1483](https://togithub.com/vercel/swr/pull/1483)
-   build(deps): bump tmpl from 1.0.4 to 1.0.5 by [@&#8203;dependabot](https://togithub.com/dependabot) in [https://github.com/vercel/swr/pull/1484](https://togithub.com/vercel/swr/pull/1484)
-   Upgrade typescript to 4.4.3 by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1486](https://togithub.com/vercel/swr/pull/1486)
-   chore: Code refactoring by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1482](https://togithub.com/vercel/swr/pull/1482)
-   ci: multiple dir type checking by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1492](https://togithub.com/vercel/swr/pull/1492)
-   Type useSWR fetcher by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1477](https://togithub.com/vercel/swr/pull/1477)
-   chore: Improve project file structure by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1497](https://togithub.com/vercel/swr/pull/1497)
-   chore: Refine type interfaces by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1496](https://togithub.com/vercel/swr/pull/1496)
-   chore: Upgrade eslint and add local cache by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1499](https://togithub.com/vercel/swr/pull/1499)
-   fix: Invalidate the key when mutating without revalidating by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1498](https://togithub.com/vercel/swr/pull/1498)
-   example: add ref checking condition by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1504](https://togithub.com/vercel/swr/pull/1504)
-   fix: Refactor core revalidate function and fix isValidating state bug by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1493](https://togithub.com/vercel/swr/pull/1493)
-   chore: remove duplicate configs by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1507](https://togithub.com/vercel/swr/pull/1507)
-   typing: fix-type-generation by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1509](https://togithub.com/vercel/swr/pull/1509)
-   chroe: use yalc for local development by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1508](https://togithub.com/vercel/swr/pull/1508)
-   chore: Code refactoring by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1521](https://togithub.com/vercel/swr/pull/1521)
-   feat: Add new onDiscarded option by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1523](https://togithub.com/vercel/swr/pull/1523)
-   fix: Error events should be deduplicated by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1522](https://togithub.com/vercel/swr/pull/1522)
-   chore: Output test code coverage by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1511](https://togithub.com/vercel/swr/pull/1511)
-   chore: Mark returned states and mutate callback argument as readonly by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1514](https://togithub.com/vercel/swr/pull/1514)
-   test: Add tests for reconnect and merge-config by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1530](https://togithub.com/vercel/swr/pull/1530)
-   fix: Only trigger the success event if not discarded by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1529](https://togithub.com/vercel/swr/pull/1529)
-   chore: Code refactoring by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1533](https://togithub.com/vercel/swr/pull/1533)
-   Add revalidateFirstPage option to swr/infinite ([#&#8203;1401](https://togithub.com/vercel/swr/issues/1401)) by [@&#8203;timas130](https://togithub.com/timas130) in [https://github.com/vercel/swr/pull/1538](https://togithub.com/vercel/swr/pull/1538)
-   fix: Reusing cache provider by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1539](https://togithub.com/vercel/swr/pull/1539)
-   chore: fix ts comments by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1540](https://togithub.com/vercel/swr/pull/1540)
-   fix: Ensure mutate accepts undefined as the data by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1515](https://togithub.com/vercel/swr/pull/1515)
-   chore: Fix comment and startAt type by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1541](https://togithub.com/vercel/swr/pull/1541)
-   chore: Refactor cleanupState by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1544](https://togithub.com/vercel/swr/pull/1544)
-   feat: using latest version of `axios` with fetch interceptor by [@&#8203;danestves](https://togithub.com/danestves) in [https://github.com/vercel/swr/pull/1548](https://togithub.com/vercel/swr/pull/1548)
-   test: Add test case for mutation deduplication by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1549](https://togithub.com/vercel/swr/pull/1549)
-   test: speed up with [@&#8203;swc-node/jest](https://togithub.com/swc-node/jest) by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1569](https://togithub.com/vercel/swr/pull/1569)
-   chore: Optimizations by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1578](https://togithub.com/vercel/swr/pull/1578)
-   fix react-native issue by [@&#8203;aFINKndreas](https://togithub.com/aFINKndreas) in [https://github.com/vercel/swr/pull/1583](https://togithub.com/vercel/swr/pull/1583)
-   fix: Support for functions that return false by [@&#8203;TakahiroHimi](https://togithub.com/TakahiroHimi) in [https://github.com/vercel/swr/pull/1586](https://togithub.com/vercel/swr/pull/1586)
-   fix: adds undefined as valid Key type to allow falsy Key or Key() by [@&#8203;morgs32](https://togithub.com/morgs32) in [https://github.com/vercel/swr/pull/1594](https://togithub.com/vercel/swr/pull/1594)
-   fix: can't find variable removeEventListener by [@&#8203;zhaomengfan](https://togithub.com/zhaomengfan) in [https://github.com/vercel/swr/pull/1595](https://togithub.com/vercel/swr/pull/1595)
-   Revert "chore: Mark returned states and mutate callback argument as readonly" by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1570](https://togithub.com/vercel/swr/pull/1570)
-   fix: change config alteration process in withMiddleware to be immutable by [@&#8203;junsushin-dev](https://togithub.com/junsushin-dev) in [https://github.com/vercel/swr/pull/1556](https://togithub.com/vercel/swr/pull/1556)
-   fix: Allow empty mutate argument list for infinite by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1602](https://togithub.com/vercel/swr/pull/1602)
-   chore: Add `type: "module"` and use `.mjs` extension by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1604](https://togithub.com/vercel/swr/pull/1604)
-   Revert "chore: Add type: "module" and use .mjs extension ([#&#8203;1604](https://togithub.com/vercel/swr/issues/1604))" by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1618](https://togithub.com/vercel/swr/pull/1618)
-   enhance: bind removeEventListener by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1596](https://togithub.com/vercel/swr/pull/1596)
-   fix: typos by [@&#8203;nguyenyou](https://togithub.com/nguyenyou) in [https://github.com/vercel/swr/pull/1647](https://togithub.com/vercel/swr/pull/1647)
-   build: output without minification by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1650](https://togithub.com/vercel/swr/pull/1650)
-   Tweak types by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1640](https://togithub.com/vercel/swr/pull/1640)
-   fix: supports ssr in ie11([#&#8203;1657](https://togithub.com/vercel/swr/issues/1657)) by [@&#8203;Sh031224](https://togithub.com/Sh031224) in [https://github.com/vercel/swr/pull/1659](https://togithub.com/vercel/swr/pull/1659)
-   type: disbale inference when data generic is provided by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1658](https://togithub.com/vercel/swr/pull/1658)
-   chore: rename major branch to main by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1664](https://togithub.com/vercel/swr/pull/1664)
-   fix keyloader index and previousPageData type by [@&#8203;promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1669](https://togithub.com/vercel/swr/pull/1669)
-   Add defaults for SWRResponse by [@&#8203;TakahiroHimi](https://togithub.com/TakahiroHimi) in [https://github.com/vercel/swr/pull/1609](https://togithub.com/vercel/swr/pull/1609)
-   example: update typescript examples with strict ts mode by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1673](https://togithub.com/vercel/swr/pull/1673)
-   chore: upgrade eslint to v8 and prettier to v2 by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1674](https://togithub.com/vercel/swr/pull/1674)
-   fix: remove unnecessary async by [@&#8203;Cut0](https://togithub.com/Cut0) in [https://github.com/vercel/swr/pull/1676](https://togithub.com/vercel/swr/pull/1676)
-   types: remove duplicated typing def by [@&#8203;huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1675](https://togithub.com/vercel/swr/pull/1675)
-   chore: Add test case for `getKey` in `useSWRInfinite` by [@&#8203;shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1681](https://togithub.com/vercel/swr/pull/1681)

#### New Contributors

-   [@&#8203;willheslam](https://togithub.com/willheslam) made their first contribution in [https://github.com/vercel/swr/pull/1393](https://togithub.com/vercel/swr/pull/1393)
-   [@&#8203;louisgv](https://togithub.com/louisgv) made their first contribution in [https://github.com/vercel/swr/pull/1406](https://togithub.com/vercel/swr/pull/1406)
-   [@&#8203;origin-master](https://togithub.com/origin-master) made their first contribution in [https://github.com/vercel/swr/pull/1409](https://togithub.com/vercel/swr/pull/1409)
-   [@&#8203;anirudh1713](https://togithub.com/anirudh1713) made their first contribution in [https://github.com/vercel/swr/pull/1431](https://togithub.com/vercel/swr/pull/1431)
-   [@&#8203;amannn](https://togithub.com/amannn) made their first contribution in [https://github.com/vercel/swr/pull/1463](https://togithub.com/vercel/swr/pull/1463)
-   [@&#8203;timas130](https://togithub.com/timas130) made their first contribution in [https://github.com/vercel/swr/pull/1538](https://togithub.com/vercel/swr/pull/1538)
-   [@&#8203;danestves](https://togithub.com/danestves) made their first contribution in [https://github.com/vercel/swr/pull/1548](https://togithub.com/vercel/swr/pull/1548)
-   [@&#8203;aFINKndreas](https://togithub.com/aFINKndreas) made their first contribution in [https://github.com/vercel/swr/pull/1583](https://togithub.com/vercel/swr/pull/1583)
-   [@&#8203;TakahiroHimi](https://togithub.com/TakahiroHimi) made their first contribution in [https://github.com/vercel/swr/pull/1586](https://togithub.com/vercel/swr/pull/1586)
-   [@&#8203;zhaomengfan](https://togithub.com/zhaomengfan) made their first contribution in [https://github.com/vercel/swr/pull/1595](https://togithub.com/vercel/swr/pull/1595)
-   [@&#8203;junsushin-dev](https://togithub.com/junsushin-dev) made their first contribution in [https://github.com/vercel/swr/pull/1556](https://togithub.com/vercel/swr/pull/1556)
-   [@&#8203;nguyenyou](https://togithub.com/nguyenyou) made their first contribution in [https://github.com/vercel/swr/pull/1647](https://togithub.com/vercel/swr/pull/1647)
-   [@&#8203;Sh031224](https://togithub.com/Sh031224) made their first contribution in [https://github.com/vercel/swr/pull/1659](https://togithub.com/vercel/swr/pull/1659)
-   [@&#8203;Cut0](https://togithub.com/Cut0) made their first contribution in [https://github.com/vercel/swr/pull/1676](https://togithub.com/vercel/swr/pull/1676)

**Full Changelog**: vercel/swr@1.0.1...1.1.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/vercel/turborepo).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not compatible ie11
2 participants