vercel/swr
### [`v2.0.0`](https://togithub.com/vercel/swr/releases/tag/2.0.0)
[Compare Source](https://togithub.com/vercel/swr/compare/1.3.0...2.0.0)
### Announcing SWR 2.0
We are excited to announce the release of SWR 2.0! The new version comes with a lot of improvements:
- New useSWRMutation hook
- Enhanced mutation and optimistic UI capabilities
- SWR DevTools
- Preload resource
- Improved React 18 support
And more!
Read our blog post and migration guide: **https://swr.vercel.app/blog/swr-v2**
#### What's Changed
- bugfix: make suspense and revalidateIfStale work together by [@simowe](https://togithub.com/simowe) in [https://github.com/vercel/swr/pull/1851](https://togithub.com/vercel/swr/pull/1851)
- feat: support functional optimisticData by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1861](https://togithub.com/vercel/swr/pull/1861)
- test: fix an act warning by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1888](https://togithub.com/vercel/swr/pull/1888)
- breaking: Change the fetcher argument to be consistent with the passed key by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1864](https://togithub.com/vercel/swr/pull/1864)
- Keep all fields with one single key by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1863](https://togithub.com/vercel/swr/pull/1863)
- fix: wrong spell by [@baojie223](https://togithub.com/baojie223) in [https://github.com/vercel/swr/pull/1902](https://togithub.com/vercel/swr/pull/1902)
- Update React 18 dependencies by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1824](https://togithub.com/vercel/swr/pull/1824)
- build(deps): bump minimist from 1.2.5 to 1.2.6 by [@dependabot](https://togithub.com/dependabot) in [https://github.com/vercel/swr/pull/1903](https://togithub.com/vercel/swr/pull/1903)
- type: make type inference simpler by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1908](https://togithub.com/vercel/swr/pull/1908)
- type: fix type error on SWRConfig by [@Himself65](https://togithub.com/Himself65) in [https://github.com/vercel/swr/pull/1913](https://togithub.com/vercel/swr/pull/1913)
- feat: Hook for remote mutations by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1450](https://togithub.com/vercel/swr/pull/1450)
- Add isFallback state by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1925](https://togithub.com/vercel/swr/pull/1925)
- build: output mutation cjs bundle with named exports by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1926](https://togithub.com/vercel/swr/pull/1926)
- Add `isLoading` state and refactor the core by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1928](https://togithub.com/vercel/swr/pull/1928)
- Add `keepPreviousData` option by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1929](https://togithub.com/vercel/swr/pull/1929)
- types: drop legacy types by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1930](https://togithub.com/vercel/swr/pull/1930)
- breaking: Throw error when using suspense on the server side without fallback in React 18 by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1931](https://togithub.com/vercel/swr/pull/1931)
- type: extends useConfig cache interface by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1938](https://togithub.com/vercel/swr/pull/1938)
- remove mount check for react18 by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1927](https://togithub.com/vercel/swr/pull/1927)
- lint: dont check unused vars with underscore prefix by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1939](https://togithub.com/vercel/swr/pull/1939)
- test: upgrade to jest 28 by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1942](https://togithub.com/vercel/swr/pull/1942)
- Fix cache types by [@chibicode](https://togithub.com/chibicode) in [https://github.com/vercel/swr/pull/1961](https://togithub.com/vercel/swr/pull/1961)
- Improved React 18 support by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1962](https://togithub.com/vercel/swr/pull/1962)
- types: fix type regressions by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1966](https://togithub.com/vercel/swr/pull/1966)
- fix: mutate args for useSWRInfinite hook by [@sanjeev29](https://togithub.com/sanjeev29) in [https://github.com/vercel/swr/pull/1947](https://togithub.com/vercel/swr/pull/1947)
- build: import with-selector with extension from useESE by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1967](https://togithub.com/vercel/swr/pull/1967)
- Bug fixes by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1968](https://togithub.com/vercel/swr/pull/1968)
- chore: Faster type checking by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1969](https://togithub.com/vercel/swr/pull/1969)
- fix: try fix codesanbox ci import error by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1971](https://togithub.com/vercel/swr/pull/1971)
- Fix race conditions related to optimistic UI by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1970](https://togithub.com/vercel/swr/pull/1970)
- chore: Add test cases for mutate by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1976](https://togithub.com/vercel/swr/pull/1976)
- fix: Should always reset to the original data after mutating with optimistic data by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1982](https://togithub.com/vercel/swr/pull/1982)
- refactor: remove useless ref copy by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1981](https://togithub.com/vercel/swr/pull/1981)
- chore: switch to pnpm and turborepo by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1983](https://togithub.com/vercel/swr/pull/1983)
- fix: should only update cache when actually start new request by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1986](https://togithub.com/vercel/swr/pull/1986)
- chore: save some bytes by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1991](https://togithub.com/vercel/swr/pull/1991)
- fix: useSWRMutation - clear error after successful trigger ([#1973](https://togithub.com/vercel/swr/issues/1973)) by [@anirudh1713](https://togithub.com/anirudh1713) in [https://github.com/vercel/swr/pull/1995](https://togithub.com/vercel/swr/pull/1995)
- Fix typo: getSWRCacahe -> getSWRCache by [@sdornan](https://togithub.com/sdornan) in [https://github.com/vercel/swr/pull/2000](https://togithub.com/vercel/swr/pull/2000)
- build: do not abort on watch mode when ts erroring by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1992](https://togithub.com/vercel/swr/pull/1992)
- chore: add engine field to limit pnpm version by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1990](https://togithub.com/vercel/swr/pull/1990)
- test: add test case for [#1974](https://togithub.com/vercel/swr/issues/1974) by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2005](https://togithub.com/vercel/swr/pull/2005)
- fix: Adding debounce for autocomplete-suggestions example by [@Walkeryr](https://togithub.com/Walkeryr) in [https://github.com/vercel/swr/pull/2017](https://togithub.com/vercel/swr/pull/2017)
- BREAKING: rename SWRConfig.default to SWRConfig.defaultValue by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2023](https://togithub.com/vercel/swr/pull/2023)
- feat: support functional swr context config by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2024](https://togithub.com/vercel/swr/pull/2024)
- test: fix all act warnings by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2031](https://togithub.com/vercel/swr/pull/2031)
- feat: add preload function by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2026](https://togithub.com/vercel/swr/pull/2026)
- fix: Avoid preloading the resource multiple times by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/2036](https://togithub.com/vercel/swr/pull/2036)
- fix: isLoading and isValidating should always respect cache value by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2048](https://togithub.com/vercel/swr/pull/2048)
- Fix ts type generation by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2038](https://togithub.com/vercel/swr/pull/2038)
- feat: mutate filter by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1989](https://togithub.com/vercel/swr/pull/1989)
- Fix typos by [@hiro0218](https://togithub.com/hiro0218) in [https://github.com/vercel/swr/pull/2052](https://togithub.com/vercel/swr/pull/2052)
- feat: add DevTools hook by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2016](https://togithub.com/vercel/swr/pull/2016)
- Use consistent typing imports by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2061](https://togithub.com/vercel/swr/pull/2061)
- Upgrading use-sync-external-store lib by [@sanjaiyan-dev](https://togithub.com/sanjaiyan-dev) in [https://github.com/vercel/swr/pull/2063](https://togithub.com/vercel/swr/pull/2063)
- Revert swr config generic by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2065](https://togithub.com/vercel/swr/pull/2065)
- Fix: raf return type by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2074](https://togithub.com/vercel/swr/pull/2074)
- Remove unused info from dummy package.json by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2083](https://togithub.com/vercel/swr/pull/2083)
- Use pnpm workspace by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2085](https://togithub.com/vercel/swr/pull/2085)
- bump typescript and apply nodenext module resolution by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2084](https://togithub.com/vercel/swr/pull/2084)
- Chore: Typos and grammar by [@AllanOliveiraM](https://togithub.com/AllanOliveiraM) in [https://github.com/vercel/swr/pull/2094](https://togithub.com/vercel/swr/pull/2094)
- chore: add basic tsdoc by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2089](https://togithub.com/vercel/swr/pull/2089)
- types: add generic for SWRInfiniteKeyLoader by [@jason89521](https://togithub.com/jason89521) in [https://github.com/vercel/swr/pull/2104](https://togithub.com/vercel/swr/pull/2104)
- fix: add swr/\_internal to paths by [@jason89521](https://togithub.com/jason89521) in [https://github.com/vercel/swr/pull/2105](https://togithub.com/vercel/swr/pull/2105)
- type: make tsconfig simpler and fix type error by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2115](https://togithub.com/vercel/swr/pull/2115)
- chore: exclude .tsbuildinfo from files, reduce install size by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2119](https://togithub.com/vercel/swr/pull/2119)
- Reorder exports conditions by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2130](https://togithub.com/vercel/swr/pull/2130)
- Upgrade bunchee by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2132](https://togithub.com/vercel/swr/pull/2132)
- Bump typescript and assemble pnpm scripts by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2133](https://togithub.com/vercel/swr/pull/2133)
- chore: add github actions reporter by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2131](https://togithub.com/vercel/swr/pull/2131)
- Dedupe installed swc by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2136](https://togithub.com/vercel/swr/pull/2136)
- test: add a test for preload API in effects by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2138](https://togithub.com/vercel/swr/pull/2138)
- test: add more isLoading tests for the case a key is null or an error by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2141](https://togithub.com/vercel/swr/pull/2141)
- ci: use action/setup-node built-in pnpm cache and bump to node16 by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2142](https://togithub.com/vercel/swr/pull/2142)
- test: add tests for dependency collection by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2140](https://togithub.com/vercel/swr/pull/2140)
- chore: bump dev deps by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2143](https://togithub.com/vercel/swr/pull/2143)
- memoize config values to avoid frequent context propagation by [@gnoff](https://togithub.com/gnoff) in [https://github.com/vercel/swr/pull/2149](https://togithub.com/vercel/swr/pull/2149)
- Bundle types into one file by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2150](https://togithub.com/vercel/swr/pull/2150)
- Revert target option by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2151](https://togithub.com/vercel/swr/pull/2151)
- chore: fix missing husky warning by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2160](https://togithub.com/vercel/swr/pull/2160)
- Remove downlevelIteration and traverse iterator manually by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2181](https://togithub.com/vercel/swr/pull/2181)
- fix: re-render when returned data and fallbackData is the same and keepPreviousData is enabled by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2169](https://togithub.com/vercel/swr/pull/2169)
- breaking: Change the error broadcasting behavior in mutations and add `throwOnError` option by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/2182](https://togithub.com/vercel/swr/pull/2182)
- docs: Add JSDoc comments to useSWRMutation by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/2183](https://togithub.com/vercel/swr/pull/2183)
- type: export MutationFetcher by [@ssssota](https://togithub.com/ssssota) in [https://github.com/vercel/swr/pull/2184](https://togithub.com/vercel/swr/pull/2184)
- Bump bundler by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2187](https://togithub.com/vercel/swr/pull/2187)
- resolve swr internal imports as external by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2225](https://togithub.com/vercel/swr/pull/2225)
- test: update tests alias to swr subpath exports by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2243](https://togithub.com/vercel/swr/pull/2243)
- feat: support functional rollbackOnError by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2242](https://togithub.com/vercel/swr/pull/2242)
- Update build target to es2018 by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/2249](https://togithub.com/vercel/swr/pull/2249)
- Fix missing esmodule mark in cjs build by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2251](https://togithub.com/vercel/swr/pull/2251)
- fix: pass null fetcher to middleware by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2240](https://togithub.com/vercel/swr/pull/2240)
#### New Contributors
- [@simowe](https://togithub.com/simowe) made their first contribution in [https://github.com/vercel/swr/pull/1851](https://togithub.com/vercel/swr/pull/1851)
- [@baojie223](https://togithub.com/baojie223) made their first contribution in [https://github.com/vercel/swr/pull/1902](https://togithub.com/vercel/swr/pull/1902)
- [@Himself65](https://togithub.com/Himself65) made their first contribution in [https://github.com/vercel/swr/pull/1913](https://togithub.com/vercel/swr/pull/1913)
- [@chibicode](https://togithub.com/chibicode) made their first contribution in [https://github.com/vercel/swr/pull/1961](https://togithub.com/vercel/swr/pull/1961)
- [@sanjeev29](https://togithub.com/sanjeev29) made their first contribution in [https://github.com/vercel/swr/pull/1947](https://togithub.com/vercel/swr/pull/1947)
- [@sdornan](https://togithub.com/sdornan) made their first contribution in [https://github.com/vercel/swr/pull/2000](https://togithub.com/vercel/swr/pull/2000)
- [@Walkeryr](https://togithub.com/Walkeryr) made their first contribution in [https://github.com/vercel/swr/pull/2017](https://togithub.com/vercel/swr/pull/2017)
- [@hiro0218](https://togithub.com/hiro0218) made their first contribution in [https://github.com/vercel/swr/pull/2052](https://togithub.com/vercel/swr/pull/2052)
- [@sanjaiyan-dev](https://togithub.com/sanjaiyan-dev) made their first contribution in [https://github.com/vercel/swr/pull/2063](https://togithub.com/vercel/swr/pull/2063)
- [@AllanOliveiraM](https://togithub.com/AllanOliveiraM) made their first contribution in [https://github.com/vercel/swr/pull/2094](https://togithub.com/vercel/swr/pull/2094)
- [@jason89521](https://togithub.com/jason89521) made their first contribution in [https://github.com/vercel/swr/pull/2104](https://togithub.com/vercel/swr/pull/2104)
- [@gnoff](https://togithub.com/gnoff) made their first contribution in [https://github.com/vercel/swr/pull/2149](https://togithub.com/vercel/swr/pull/2149)
- [@ssssota](https://togithub.com/ssssota) made their first contribution in [https://github.com/vercel/swr/pull/2184](https://togithub.com/vercel/swr/pull/2184)
**Full Changelog**: https://github.com/vercel/swr/compare/1.2.2...2.0.0
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.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
1.3.0
->2.0.0
Release Notes
vercel/swr
### [`v2.0.0`](https://togithub.com/vercel/swr/releases/tag/2.0.0) [Compare Source](https://togithub.com/vercel/swr/compare/1.3.0...2.0.0) ### Announcing SWR 2.0 We are excited to announce the release of SWR 2.0! The new version comes with a lot of improvements: - New useSWRMutation hook - Enhanced mutation and optimistic UI capabilities - SWR DevTools - Preload resource - Improved React 18 support And more! Read our blog post and migration guide: **https://swr.vercel.app/blog/swr-v2** #### What's Changed - bugfix: make suspense and revalidateIfStale work together by [@simowe](https://togithub.com/simowe) in [https://github.com/vercel/swr/pull/1851](https://togithub.com/vercel/swr/pull/1851) - feat: support functional optimisticData by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1861](https://togithub.com/vercel/swr/pull/1861) - test: fix an act warning by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1888](https://togithub.com/vercel/swr/pull/1888) - breaking: Change the fetcher argument to be consistent with the passed key by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1864](https://togithub.com/vercel/swr/pull/1864) - Keep all fields with one single key by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1863](https://togithub.com/vercel/swr/pull/1863) - fix: wrong spell by [@baojie223](https://togithub.com/baojie223) in [https://github.com/vercel/swr/pull/1902](https://togithub.com/vercel/swr/pull/1902) - Update React 18 dependencies by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1824](https://togithub.com/vercel/swr/pull/1824) - build(deps): bump minimist from 1.2.5 to 1.2.6 by [@dependabot](https://togithub.com/dependabot) in [https://github.com/vercel/swr/pull/1903](https://togithub.com/vercel/swr/pull/1903) - type: make type inference simpler by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1908](https://togithub.com/vercel/swr/pull/1908) - type: fix type error on SWRConfig by [@Himself65](https://togithub.com/Himself65) in [https://github.com/vercel/swr/pull/1913](https://togithub.com/vercel/swr/pull/1913) - feat: Hook for remote mutations by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1450](https://togithub.com/vercel/swr/pull/1450) - Add isFallback state by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1925](https://togithub.com/vercel/swr/pull/1925) - build: output mutation cjs bundle with named exports by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1926](https://togithub.com/vercel/swr/pull/1926) - Add `isLoading` state and refactor the core by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1928](https://togithub.com/vercel/swr/pull/1928) - Add `keepPreviousData` option by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1929](https://togithub.com/vercel/swr/pull/1929) - types: drop legacy types by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1930](https://togithub.com/vercel/swr/pull/1930) - breaking: Throw error when using suspense on the server side without fallback in React 18 by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1931](https://togithub.com/vercel/swr/pull/1931) - type: extends useConfig cache interface by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1938](https://togithub.com/vercel/swr/pull/1938) - remove mount check for react18 by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1927](https://togithub.com/vercel/swr/pull/1927) - lint: dont check unused vars with underscore prefix by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1939](https://togithub.com/vercel/swr/pull/1939) - test: upgrade to jest 28 by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1942](https://togithub.com/vercel/swr/pull/1942) - Fix cache types by [@chibicode](https://togithub.com/chibicode) in [https://github.com/vercel/swr/pull/1961](https://togithub.com/vercel/swr/pull/1961) - Improved React 18 support by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1962](https://togithub.com/vercel/swr/pull/1962) - types: fix type regressions by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1966](https://togithub.com/vercel/swr/pull/1966) - fix: mutate args for useSWRInfinite hook by [@sanjeev29](https://togithub.com/sanjeev29) in [https://github.com/vercel/swr/pull/1947](https://togithub.com/vercel/swr/pull/1947) - build: import with-selector with extension from useESE by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1967](https://togithub.com/vercel/swr/pull/1967) - Bug fixes by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1968](https://togithub.com/vercel/swr/pull/1968) - chore: Faster type checking by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1969](https://togithub.com/vercel/swr/pull/1969) - fix: try fix codesanbox ci import error by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1971](https://togithub.com/vercel/swr/pull/1971) - Fix race conditions related to optimistic UI by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1970](https://togithub.com/vercel/swr/pull/1970) - chore: Add test cases for mutate by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1976](https://togithub.com/vercel/swr/pull/1976) - fix: Should always reset to the original data after mutating with optimistic data by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1982](https://togithub.com/vercel/swr/pull/1982) - refactor: remove useless ref copy by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1981](https://togithub.com/vercel/swr/pull/1981) - chore: switch to pnpm and turborepo by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1983](https://togithub.com/vercel/swr/pull/1983) - fix: should only update cache when actually start new request by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1986](https://togithub.com/vercel/swr/pull/1986) - chore: save some bytes by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1991](https://togithub.com/vercel/swr/pull/1991) - fix: useSWRMutation - clear error after successful trigger ([#1973](https://togithub.com/vercel/swr/issues/1973)) by [@anirudh1713](https://togithub.com/anirudh1713) in [https://github.com/vercel/swr/pull/1995](https://togithub.com/vercel/swr/pull/1995) - Fix typo: getSWRCacahe -> getSWRCache by [@sdornan](https://togithub.com/sdornan) in [https://github.com/vercel/swr/pull/2000](https://togithub.com/vercel/swr/pull/2000) - build: do not abort on watch mode when ts erroring by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1992](https://togithub.com/vercel/swr/pull/1992) - chore: add engine field to limit pnpm version by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1990](https://togithub.com/vercel/swr/pull/1990) - test: add test case for [#1974](https://togithub.com/vercel/swr/issues/1974) by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2005](https://togithub.com/vercel/swr/pull/2005) - fix: Adding debounce for autocomplete-suggestions example by [@Walkeryr](https://togithub.com/Walkeryr) in [https://github.com/vercel/swr/pull/2017](https://togithub.com/vercel/swr/pull/2017) - BREAKING: rename SWRConfig.default to SWRConfig.defaultValue by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2023](https://togithub.com/vercel/swr/pull/2023) - feat: support functional swr context config by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2024](https://togithub.com/vercel/swr/pull/2024) - test: fix all act warnings by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2031](https://togithub.com/vercel/swr/pull/2031) - feat: add preload function by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2026](https://togithub.com/vercel/swr/pull/2026) - fix: Avoid preloading the resource multiple times by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/2036](https://togithub.com/vercel/swr/pull/2036) - fix: isLoading and isValidating should always respect cache value by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2048](https://togithub.com/vercel/swr/pull/2048) - Fix ts type generation by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2038](https://togithub.com/vercel/swr/pull/2038) - feat: mutate filter by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1989](https://togithub.com/vercel/swr/pull/1989) - Fix typos by [@hiro0218](https://togithub.com/hiro0218) in [https://github.com/vercel/swr/pull/2052](https://togithub.com/vercel/swr/pull/2052) - feat: add DevTools hook by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2016](https://togithub.com/vercel/swr/pull/2016) - Use consistent typing imports by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2061](https://togithub.com/vercel/swr/pull/2061) - Upgrading use-sync-external-store lib by [@sanjaiyan-dev](https://togithub.com/sanjaiyan-dev) in [https://github.com/vercel/swr/pull/2063](https://togithub.com/vercel/swr/pull/2063) - Revert swr config generic by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2065](https://togithub.com/vercel/swr/pull/2065) - Fix: raf return type by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2074](https://togithub.com/vercel/swr/pull/2074) - Remove unused info from dummy package.json by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2083](https://togithub.com/vercel/swr/pull/2083) - Use pnpm workspace by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2085](https://togithub.com/vercel/swr/pull/2085) - bump typescript and apply nodenext module resolution by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2084](https://togithub.com/vercel/swr/pull/2084) - Chore: Typos and grammar by [@AllanOliveiraM](https://togithub.com/AllanOliveiraM) in [https://github.com/vercel/swr/pull/2094](https://togithub.com/vercel/swr/pull/2094) - chore: add basic tsdoc by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2089](https://togithub.com/vercel/swr/pull/2089) - types: add generic for SWRInfiniteKeyLoader by [@jason89521](https://togithub.com/jason89521) in [https://github.com/vercel/swr/pull/2104](https://togithub.com/vercel/swr/pull/2104) - fix: add swr/\_internal to paths by [@jason89521](https://togithub.com/jason89521) in [https://github.com/vercel/swr/pull/2105](https://togithub.com/vercel/swr/pull/2105) - type: make tsconfig simpler and fix type error by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2115](https://togithub.com/vercel/swr/pull/2115) - chore: exclude .tsbuildinfo from files, reduce install size by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2119](https://togithub.com/vercel/swr/pull/2119) - Reorder exports conditions by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2130](https://togithub.com/vercel/swr/pull/2130) - Upgrade bunchee by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2132](https://togithub.com/vercel/swr/pull/2132) - Bump typescript and assemble pnpm scripts by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2133](https://togithub.com/vercel/swr/pull/2133) - chore: add github actions reporter by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2131](https://togithub.com/vercel/swr/pull/2131) - Dedupe installed swc by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2136](https://togithub.com/vercel/swr/pull/2136) - test: add a test for preload API in effects by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2138](https://togithub.com/vercel/swr/pull/2138) - test: add more isLoading tests for the case a key is null or an error by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2141](https://togithub.com/vercel/swr/pull/2141) - ci: use action/setup-node built-in pnpm cache and bump to node16 by [@promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2142](https://togithub.com/vercel/swr/pull/2142) - test: add tests for dependency collection by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2140](https://togithub.com/vercel/swr/pull/2140) - chore: bump dev deps by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2143](https://togithub.com/vercel/swr/pull/2143) - memoize config values to avoid frequent context propagation by [@gnoff](https://togithub.com/gnoff) in [https://github.com/vercel/swr/pull/2149](https://togithub.com/vercel/swr/pull/2149) - Bundle types into one file by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2150](https://togithub.com/vercel/swr/pull/2150) - Revert target option by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2151](https://togithub.com/vercel/swr/pull/2151) - chore: fix missing husky warning by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2160](https://togithub.com/vercel/swr/pull/2160) - Remove downlevelIteration and traverse iterator manually by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2181](https://togithub.com/vercel/swr/pull/2181) - fix: re-render when returned data and fallbackData is the same and keepPreviousData is enabled by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2169](https://togithub.com/vercel/swr/pull/2169) - breaking: Change the error broadcasting behavior in mutations and add `throwOnError` option by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/2182](https://togithub.com/vercel/swr/pull/2182) - docs: Add JSDoc comments to useSWRMutation by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/2183](https://togithub.com/vercel/swr/pull/2183) - type: export MutationFetcher by [@ssssota](https://togithub.com/ssssota) in [https://github.com/vercel/swr/pull/2184](https://togithub.com/vercel/swr/pull/2184) - Bump bundler by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2187](https://togithub.com/vercel/swr/pull/2187) - resolve swr internal imports as external by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2225](https://togithub.com/vercel/swr/pull/2225) - test: update tests alias to swr subpath exports by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2243](https://togithub.com/vercel/swr/pull/2243) - feat: support functional rollbackOnError by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2242](https://togithub.com/vercel/swr/pull/2242) - Update build target to es2018 by [@shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/2249](https://togithub.com/vercel/swr/pull/2249) - Fix missing esmodule mark in cjs build by [@huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2251](https://togithub.com/vercel/swr/pull/2251) - fix: pass null fetcher to middleware by [@koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2240](https://togithub.com/vercel/swr/pull/2240) #### New Contributors - [@simowe](https://togithub.com/simowe) made their first contribution in [https://github.com/vercel/swr/pull/1851](https://togithub.com/vercel/swr/pull/1851) - [@baojie223](https://togithub.com/baojie223) made their first contribution in [https://github.com/vercel/swr/pull/1902](https://togithub.com/vercel/swr/pull/1902) - [@Himself65](https://togithub.com/Himself65) made their first contribution in [https://github.com/vercel/swr/pull/1913](https://togithub.com/vercel/swr/pull/1913) - [@chibicode](https://togithub.com/chibicode) made their first contribution in [https://github.com/vercel/swr/pull/1961](https://togithub.com/vercel/swr/pull/1961) - [@sanjeev29](https://togithub.com/sanjeev29) made their first contribution in [https://github.com/vercel/swr/pull/1947](https://togithub.com/vercel/swr/pull/1947) - [@sdornan](https://togithub.com/sdornan) made their first contribution in [https://github.com/vercel/swr/pull/2000](https://togithub.com/vercel/swr/pull/2000) - [@Walkeryr](https://togithub.com/Walkeryr) made their first contribution in [https://github.com/vercel/swr/pull/2017](https://togithub.com/vercel/swr/pull/2017) - [@hiro0218](https://togithub.com/hiro0218) made their first contribution in [https://github.com/vercel/swr/pull/2052](https://togithub.com/vercel/swr/pull/2052) - [@sanjaiyan-dev](https://togithub.com/sanjaiyan-dev) made their first contribution in [https://github.com/vercel/swr/pull/2063](https://togithub.com/vercel/swr/pull/2063) - [@AllanOliveiraM](https://togithub.com/AllanOliveiraM) made their first contribution in [https://github.com/vercel/swr/pull/2094](https://togithub.com/vercel/swr/pull/2094) - [@jason89521](https://togithub.com/jason89521) made their first contribution in [https://github.com/vercel/swr/pull/2104](https://togithub.com/vercel/swr/pull/2104) - [@gnoff](https://togithub.com/gnoff) made their first contribution in [https://github.com/vercel/swr/pull/2149](https://togithub.com/vercel/swr/pull/2149) - [@ssssota](https://togithub.com/ssssota) made their first contribution in [https://github.com/vercel/swr/pull/2184](https://togithub.com/vercel/swr/pull/2184) **Full Changelog**: https://github.com/vercel/swr/compare/1.2.2...2.0.0Configuration
📅 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.