Closed renovate[bot] closed 1 year ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/yurikrupnik/batman/92xDEejw67hGMdEzwfcxbhKFnaSE
✅ Preview: https://batman-git-renovate-swr-1x-yurikrupnik.vercel.app
🔍 Inspect: https://vercel.com/yurikrupnik/alfred/Bq1bRxdMiS8dSTyc7mDFxiyRjWVr
✅ Preview: https://alfred-git-renovate-swr-1x-yurikrupnik.vercel.app
This PR contains the following updates:
0.5.6
->1.3.0
Release Notes
vercel/swr
### [`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 [@Himself65](https://togithub.com/Himself65) in [#1913](https://togithub.com/vercel/swr/issues/1913) - chore: update React 18 dependencies by [@shuding](https://togithub.com/shuding) in [#1824](https://togithub.com/vercel/swr/issues/1824) - test: fix an act warning by [@koba04](https://togithub.com/koba04) in [#1888](https://togithub.com/vercel/swr/issues/1888) - feat: support functional optimisticData by [@huozhi](https://togithub.com/huozhi) in [#1861](https://togithub.com/vercel/swr/issues/1861) - bugfix: make suspense and revalidateIfStale work together by [@simowe](https://togithub.com/simowe) in [#1851](https://togithub.com/vercel/swr/issues/1851) **Full Changelog**: https://github.com/vercel/swr/compare/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 [@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 [@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 [@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 [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1818](https://togithub.com/vercel/swr/pull/1818) **Full Changelog**: https://github.com/vercel/swr/compare/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 [@sairajchouhan](https://togithub.com/sairajchouhan) for contributing! #### What's Changed - `shouldRetryOnError` accepts a function that can be used to conditionally stop retrying by [@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 [@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 [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1830](https://togithub.com/vercel/swr/pull/1830) #### New Contributors - [@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**: https://github.com/vercel/swr/compare/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 [@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 [@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 [@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 [@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 [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1793](https://togithub.com/vercel/swr/pull/1793) - test: use [@swc/jest](https://togithub.com/swc/jest) by [@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 [@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 [@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 [@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 [@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 [@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 [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1761](https://togithub.com/vercel/swr/pull/1761) - chore: comment helper by [@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 [@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 [@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 [@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 [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1789](https://togithub.com/vercel/swr/pull/1789) - chore: zeit -> vercel by [@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 [@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 [@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 [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1795](https://togithub.com/vercel/swr/pull/1795) #### New Contributors - [@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**: https://github.com/vercel/swr/compare/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 [#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 [#1729](https://togithub.com/vercel/swr/issues/1729). #### What's Changed - Make polyfill for `requestAnimationFrame` more robust by [@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 [@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 [@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 [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1724](https://togithub.com/vercel/swr/pull/1724) - Improve test by [@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 [@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 [@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 [@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 [@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 [@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 [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1742](https://togithub.com/vercel/swr/pull/1742) #### New Contributors - [@thomaspaulmann](https://togithub.com/thomaspaulmann) made their first contribution in [https://github.com/vercel/swr/pull/1707](https://togithub.com/vercel/swr/pull/1707) - [@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**: https://github.com/vercel/swr/compare/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 [@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 [@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 [@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 [@icyJoseph](https://togithub.com/icyJoseph) in [https://github.com/vercel/swr/pull/1698](https://togithub.com/vercel/swr/pull/1698) #### New Contributors - [@Andrewnt219](https://togithub.com/Andrewnt219) made their first contribution in [https://github.com/vercel/swr/pull/1690](https://togithub.com/vercel/swr/pull/1690) - [@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**: https://github.com/vercel/swr/compare/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 [@anirudh1713](https://togithub.com/anirudh1713) in [https://github.com/vercel/swr/pull/1431](https://togithub.com/vercel/swr/pull/1431) - Stable hash by [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1459](https://togithub.com/vercel/swr/pull/1459) - fix: Support IE11 by [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1486](https://togithub.com/vercel/swr/pull/1486) - chore: Code refactoring by [@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 [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1492](https://togithub.com/vercel/swr/pull/1492) - Type useSWR fetcher by [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1508](https://togithub.com/vercel/swr/pull/1508) - chore: Code refactoring by [@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 [@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 [@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 [@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 [@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 [@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 [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1529](https://togithub.com/vercel/swr/pull/1529) - chore: Code refactoring by [@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 ([#1401](https://togithub.com/vercel/swr/issues/1401)) by [@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 [@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 [@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 [@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 [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1541](https://togithub.com/vercel/swr/pull/1541) - chore: Refactor cleanupState by [@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 [@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 [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1549](https://togithub.com/vercel/swr/pull/1549) - test: speed up with [@swc-node/jest](https://togithub.com/swc-node/jest) by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1569](https://togithub.com/vercel/swr/pull/1569) - chore: Optimizations by [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 ([#1604](https://togithub.com/vercel/swr/issues/1604))" by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1618](https://togithub.com/vercel/swr/pull/1618) - enhance: bind removeEventListener by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1596](https://togithub.com/vercel/swr/pull/1596) - fix: typos by [@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 [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1650](https://togithub.com/vercel/swr/pull/1650) - Tweak types by [@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([#1657](https://togithub.com/vercel/swr/issues/1657)) by [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@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 [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1681](https://togithub.com/vercel/swr/pull/1681) #### New Contributors - [@willheslam](https://togithub.com/willheslam) made their first contribution in [https://github.com/vercel/swr/pull/1393](https://togithub.com/vercel/swr/pull/1393) - [@louisgv](https://togithub.com/louisgv) made their first contribution in [https://github.com/vercel/swr/pull/1406](https://togithub.com/vercel/swr/pull/1406) - [@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) - [@anirudh1713](https://togithub.com/anirudh1713) made their first contribution in [https://github.com/vercel/swr/pull/1431](https://togithub.com/vercel/swr/pull/1431) - [@amannn](https://togithub.com/amannn) made their first contribution in [https://github.com/vercel/swr/pull/1463](https://togithub.com/vercel/swr/pull/1463) - [@timas130](https://togithub.com/timas130) made their first contribution in [https://github.com/vercel/swr/pull/1538](https://togithub.com/vercel/swr/pull/1538) - [@danestves](https://togithub.com/danestves) made their first contribution in [https://github.com/vercel/swr/pull/1548](https://togithub.com/vercel/swr/pull/1548) - [@aFINKndreas](https://togithub.com/aFINKndreas) made their first contribution in [https://github.com/vercel/swr/pull/1583](https://togithub.com/vercel/swr/pull/1583) - [@TakahiroHimi](https://togithub.com/TakahiroHimi) made their first contribution in [https://github.com/vercel/swr/pull/1586](https://togithub.com/vercel/swr/pull/1586) - [@zhaomengfan](https://togithub.com/zhaomengfan) made their first contribution in [https://github.com/vercel/swr/pull/1595](https://togithub.com/vercel/swr/pull/1595) - [@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) - [@nguyenyou](https://togithub.com/nguyenyou) made their first contribution in [https://github.com/vercel/swr/pull/1647](https://togithub.com/vercel/swr/pull/1647) - [@Sh031224](https://togithub.com/Sh031224) made their first contribution in [https://github.com/vercel/swr/pull/1659](https://togithub.com/vercel/swr/pull/1659) - [@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**: https://github.com/vercel/swr/compare/1.0.1...1.1.0 ### [`v1.0.1`](https://togithub.com/vercel/swr/releases/tag/1.0.1) [Compare Source](https://togithub.com/vercel/swr/compare/1.0.0...1.0.1) ##### Pre-releases - https://github.com/vercel/swr/releases/tag/1.0.1-beta.0 - https://github.com/vercel/swr/releases/tag/1.0.1-beta.1 ### [`v1.0.0`](https://togithub.com/vercel/swr/releases/tag/1.0.0) [Compare Source](https://togithub.com/vercel/swr/compare/19d620d61eb9edc5c457cbf7986573b853f8e5fd...1.0.0) ##### Minor Changes & Breaking Changes See full changes of this major & previous beta updates [on the Releases page](https://togithub.com/vercel/swr/releases). Also read our blog post and migration guide:Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), 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.
This PR has been generated by Mend Renovate. View repository job log here.