yuiseki / crisis-news-map-next

🗺 Source code of https://crisis.yuiseki.net/ . Web service that collects disaster-related news articles and displays them on a map.
https://crisis.yuiseki.net/
Do What The F*ck You Want To Public License
19 stars 3 forks source link

fix(deps): update dependency swr to v2 #77

Closed renovate[bot] closed 1 year ago

renovate[bot] commented 1 year ago

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
swr (source) ^0.5.6 -> ^2.0.0 age adoption passing confidence

Release Notes

vercel/swr ### [`v2.1.5`](https://togithub.com/vercel/swr/releases/tag/v2.1.5) [Compare Source](https://togithub.com/vercel/swr/compare/v2.1.4...v2.1.5) ##### What's Changed - fix: missing interop helpers in bundle by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2582](https://togithub.com/vercel/swr/pull/2582) **Full Changelog**: https://github.com/vercel/swr/compare/v2.1.4...v2.1.5 ### [`v2.1.4`](https://togithub.com/vercel/swr/releases/tag/v2.1.4) [Compare Source](https://togithub.com/vercel/swr/compare/v2.1.3...v2.1.4) ##### What's Changed - Upgrade bundler by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2557](https://togithub.com/vercel/swr/pull/2557) - examples: fix invalid links by [@​fxOne](https://togithub.com/fxOne) in [https://github.com/vercel/swr/pull/2559](https://togithub.com/vercel/swr/pull/2559) - types: Allow auto-import by improving generated types by [@​oosawy](https://togithub.com/oosawy) in [https://github.com/vercel/swr/pull/2563](https://togithub.com/vercel/swr/pull/2563) - fix: pass serialized args to preload fetcher by [@​oosawy](https://togithub.com/oosawy) in [https://github.com/vercel/swr/pull/2564](https://togithub.com/vercel/swr/pull/2564) - chore: use provenance for release by [@​HerringtonDarkholme](https://togithub.com/HerringtonDarkholme) in [https://github.com/vercel/swr/pull/2571](https://togithub.com/vercel/swr/pull/2571) - deps: update [@​testing-library/react](https://togithub.com/testing-library/react) to v14 by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2578](https://togithub.com/vercel/swr/pull/2578) - fix: Fix dependency tracking and useSES bug by [@​shuding](https://togithub.com/shuding) and [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2576](https://togithub.com/vercel/swr/pull/2576) ##### New Contributors - [@​fxOne](https://togithub.com/fxOne) made their first contribution in [https://github.com/vercel/swr/pull/2559](https://togithub.com/vercel/swr/pull/2559) - [@​oosawy](https://togithub.com/oosawy) made their first contribution in [https://github.com/vercel/swr/pull/2563](https://togithub.com/vercel/swr/pull/2563) - [@​HerringtonDarkholme](https://togithub.com/HerringtonDarkholme) made their first contribution in [https://github.com/vercel/swr/pull/2571](https://togithub.com/vercel/swr/pull/2571) **Full Changelog**: https://github.com/vercel/swr/compare/v2.1.3...v2.1.4 ### [`v2.1.3`](https://togithub.com/vercel/swr/releases/tag/v2.1.3) [Compare Source](https://togithub.com/vercel/swr/compare/v2.1.2...v2.1.3) ##### What's Changed - Fix [#​2548](https://togithub.com/vercel/swr/issues/2548): pass origin key to subcription callback by [@​Zheaoli](https://togithub.com/Zheaoli) in [https://github.com/vercel/swr/pull/2550](https://togithub.com/vercel/swr/pull/2550) - Examples: fix type in axios-typescript example by [@​daochouwangu](https://togithub.com/daochouwangu) in [https://github.com/vercel/swr/pull/2552](https://togithub.com/vercel/swr/pull/2552) - Update Cache Interface types by [@​dmmulroy](https://togithub.com/dmmulroy) in [https://github.com/vercel/swr/pull/2554](https://togithub.com/vercel/swr/pull/2554) - fix: data passed to refreshInterval function is not latest by [@​hong24](https://togithub.com/hong24) in [https://github.com/vercel/swr/pull/2354](https://togithub.com/vercel/swr/pull/2354) - types: allow passing function as `Data` for `useSWRSubscriptionOptions` by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2551](https://togithub.com/vercel/swr/pull/2551) ##### New Contributors - [@​Zheaoli](https://togithub.com/Zheaoli) made their first contribution in [https://github.com/vercel/swr/pull/2550](https://togithub.com/vercel/swr/pull/2550) - [@​daochouwangu](https://togithub.com/daochouwangu) made their first contribution in [https://github.com/vercel/swr/pull/2552](https://togithub.com/vercel/swr/pull/2552) - [@​dmmulroy](https://togithub.com/dmmulroy) made their first contribution in [https://github.com/vercel/swr/pull/2554](https://togithub.com/vercel/swr/pull/2554) **Full Changelog**: https://github.com/vercel/swr/compare/v2.1.2...v2.1.3 ### [`v2.1.2`](https://togithub.com/vercel/swr/releases/tag/v2.1.2) [Compare Source](https://togithub.com/vercel/swr/compare/v2.1.1...v2.1.2) ##### Patches - Improved type inferring for `swr/subscription` - Adding `SWRSubscriptionOptions` type for `swr/subscription` ##### Changes - test: add typing test for empty config by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2521](https://togithub.com/vercel/swr/pull/2521) - test: fix syntax error in Equal type alias implementation by [@​SACHINnANYAKKARA](https://togithub.com/SACHINnANYAKKARA) in [https://github.com/vercel/swr/pull/2517](https://togithub.com/vercel/swr/pull/2517) - chore: remove engines by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2536](https://togithub.com/vercel/swr/pull/2536) - types: improve `useSWRSubscription` types by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2535](https://togithub.com/vercel/swr/pull/2535) - Rename subscription types by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2537](https://togithub.com/vercel/swr/pull/2537) ##### New Contributors - [@​SACHINnANYAKKARA](https://togithub.com/SACHINnANYAKKARA) made their first contribution in [https://github.com/vercel/swr/pull/2517](https://togithub.com/vercel/swr/pull/2517) **Full Changelog**: https://github.com/vercel/swr/compare/v2.1.1...v2.1.2 ### [`v2.1.1`](https://togithub.com/vercel/swr/releases/tag/v2.1.1) [Compare Source](https://togithub.com/vercel/swr/compare/v2.1.0...v2.1.1) #### Patches - refactor: remove useless dataRef, always compare cached data by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2431](https://togithub.com/vercel/swr/pull/2431) - fix: swr infers incorrect `data` type for default `SWRConfig` generic type by [@​connorch](https://togithub.com/connorch) in [https://github.com/vercel/swr/pull/2506](https://togithub.com/vercel/swr/pull/2506) #### Documentation - docs: update subscription example by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2499](https://togithub.com/vercel/swr/pull/2499) #### New Contributors - [@​connorch](https://togithub.com/connorch) made their first contribution in [https://github.com/vercel/swr/pull/2506](https://togithub.com/vercel/swr/pull/2506) **Full Changelog**: https://github.com/vercel/swr/compare/v2.1.0...v2.1.1 ### [`v2.1.0`](https://togithub.com/vercel/swr/releases/tag/v2.1.0) [Compare Source](https://togithub.com/vercel/swr/compare/v2.0.4...v2.1.0) #### Feature - Subscription mode by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/1263](https://togithub.com/vercel/swr/pull/1263) - parallel option for useSWRInfinite by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2404](https://togithub.com/vercel/swr/pull/2404) Checkout [subscription docs](https://swr.vercel.app/docs/subscription) and [useSWRInfinite parallel fetching docs](https://swr.vercel.app/docs/pagination#parallel-fetching-mode) for more details #### Patches - fix: use the latest config in useSWRMutation by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2468](https://togithub.com/vercel/swr/pull/2468) - Fix: type support for suspense and fallbackData([#​2396](https://togithub.com/vercel/swr/issues/2396)) by [@​taro-28](https://togithub.com/taro-28) in [https://github.com/vercel/swr/pull/2452](https://togithub.com/vercel/swr/pull/2452) - Error should be reset when new data comes by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2472](https://togithub.com/vercel/swr/pull/2472) - fix: avoid creating new snapshot if cache is not updated at client during streaming by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2475](https://togithub.com/vercel/swr/pull/2475) - refactor: initialize the cache only on first access by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2479](https://togithub.com/vercel/swr/pull/2479) #### Misc - ci: fix publish workflow by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2453](https://togithub.com/vercel/swr/pull/2453) - ci: faster e2e test by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2428](https://togithub.com/vercel/swr/pull/2428) - test: add a test for keepPreviousData without changing key by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2470](https://togithub.com/vercel/swr/pull/2470) - Always assume subscriptions will return sub count from current key by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2460](https://togithub.com/vercel/swr/pull/2460) - test: Fix flaky e2e test by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2476](https://togithub.com/vercel/swr/pull/2476) - chore: Add subscription example by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2480](https://togithub.com/vercel/swr/pull/2480) #### New Contributors - [@​taro-28](https://togithub.com/taro-28) made their first contribution in [https://github.com/vercel/swr/pull/2452](https://togithub.com/vercel/swr/pull/2452) **Full Changelog**: https://github.com/vercel/swr/compare/v2.0.4...v2.1.0 ### [`v2.0.4`](https://togithub.com/vercel/swr/releases/tag/v2.0.4) [Compare Source](https://togithub.com/vercel/swr/compare/v2.0.3...v2.0.4) #### Patches - build: fix release job condition by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2392](https://togithub.com/vercel/swr/pull/2392) - types: fix some mutation type issue by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2421](https://togithub.com/vercel/swr/pull/2421) - fix: Error retry should be handled by global revalidator instead of local revalidation function by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2415](https://togithub.com/vercel/swr/pull/2415) - fix: ensure initCache setter function stays within bounds of subscriptions by [@​lfbergee](https://togithub.com/lfbergee) in [https://github.com/vercel/swr/pull/2411](https://togithub.com/vercel/swr/pull/2411) #### Misc - test: stream ssr e2e by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2395](https://togithub.com/vercel/swr/pull/2395) - test: fix an act warning by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2403](https://togithub.com/vercel/swr/pull/2403) #### New Contributors - [@​lfbergee](https://togithub.com/lfbergee) made their first contribution in [https://github.com/vercel/swr/pull/2411](https://togithub.com/vercel/swr/pull/2411) **Full Changelog**: https://github.com/vercel/swr/compare/v2.0.3...v2.0.4 ### [`v2.0.3`](https://togithub.com/vercel/swr/releases/tag/v2.0.3) [Compare Source](https://togithub.com/vercel/swr/compare/v2.0.2...v2.0.3) #### Patches - fix: parameters passed to subscribe is inconsistent with its declaration by [@​hong24](https://togithub.com/hong24) in [https://github.com/vercel/swr/pull/2353](https://togithub.com/vercel/swr/pull/2353) - fix: when inifinite key changes, should use cached pagesize instead of initialSize by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2386](https://togithub.com/vercel/swr/pull/2386) - fix: make compare function only compare data ([#​2375](https://togithub.com/vercel/swr/issues/2375)) by [@​Retrospection](https://togithub.com/Retrospection) and [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2387](https://togithub.com/vercel/swr/pull/2387) [https://github.com/vercel/swr/pull/2389](https://togithub.com/vercel/swr/pull/2389) - fix: initial loading state should be false with revalidation is disabed by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2382](https://togithub.com/vercel/swr/pull/2382) - fix: Ensure hydration matches the SSR result during streaming by [@​shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/2391](https://togithub.com/vercel/swr/pull/2391) #### Chores - ci: only run release when tags pushed by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2388](https://togithub.com/vercel/swr/pull/2388) - unify `-` characters in README.md by [@​JanKaifer](https://togithub.com/JanKaifer) in [https://github.com/vercel/swr/pull/2334](https://togithub.com/vercel/swr/pull/2334) #### New Contributors - [@​hong24](https://togithub.com/hong24) made their first contribution in [https://github.com/vercel/swr/pull/2353](https://togithub.com/vercel/swr/pull/2353) - [@​Retrospection](https://togithub.com/Retrospection) made their first contribution in [https://github.com/vercel/swr/pull/2387](https://togithub.com/vercel/swr/pull/2387) - [@​JanKaifer](https://togithub.com/JanKaifer) made their first contribution in [https://github.com/vercel/swr/pull/2334](https://togithub.com/vercel/swr/pull/2334) **Full Changelog**: https://github.com/vercel/swr/compare/v2.0.2...v2.0.3 ### [`v2.0.2`](https://togithub.com/vercel/swr/releases/tag/v2.0.2) [Compare Source](https://togithub.com/vercel/swr/compare/v2.0.1...v2.0.2) #### Patches - fix: delay revalidation if a key is already active and has error by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2338](https://togithub.com/vercel/swr/pull/2338) - fix: createCacheHelper type by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2365](https://togithub.com/vercel/swr/pull/2365) #### Chores - release workflow by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2374](https://togithub.com/vercel/swr/pull/2374), [https://github.com/vercel/swr/pull/2381](https://togithub.com/vercel/swr/pull/2381), [https://github.com/vercel/swr/pull/2383](https://togithub.com/vercel/swr/pull/2383), [https://github.com/vercel/swr/pull/2384](https://togithub.com/vercel/swr/pull/2384), [https://github.com/vercel/swr/pull/2385](https://togithub.com/vercel/swr/pull/2385) **Full Changelog**: https://github.com/vercel/swr/compare/v2.0.1...v2.0.2 ### [`v2.0.1`](https://togithub.com/vercel/swr/releases/tag/v2.0.1) [Compare Source](https://togithub.com/vercel/swr/compare/2.0.0...v2.0.1) In this patch release, we majorly improved typing support and SWR can infer the types based on the configuration. - When the `suspense` option is `true`, the returned `data` will exclude `undefined` and the `isLoading` will always be `false`. - When the `fallbackData` option is provided, the returned `data` will be the same type of `fallbackData`, and the `isLoading` will always be `false`. Here's a demo for it: https://user-images.githubusercontent.com/4800338/213288879-ffbeeeb5-aca5-4a65-8229-69fbf9b0bf70.mp4 #### What's Changed - types: make FullConfiguration generic by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2273](https://togithub.com/vercel/swr/pull/2273) - type: enforce array literal as tuple by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2283](https://togithub.com/vercel/swr/pull/2283) - Improve type test by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/2289](https://togithub.com/vercel/swr/pull/2289) - update bunchee to remove the extra target cli option by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2298](https://togithub.com/vercel/swr/pull/2298) - fix: useSWRMutation should always use the latest fetcher by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2290](https://togithub.com/vercel/swr/pull/2290) - types: conditional swr response by [@​huozhi](https://togithub.com/huozhi) in [https://github.com/vercel/swr/pull/2301](https://togithub.com/vercel/swr/pull/2301) - fix: types properites in exports fields by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2341](https://togithub.com/vercel/swr/pull/2341) - Update license year by [@​IcedMonk](https://togithub.com/IcedMonk) in [https://github.com/vercel/swr/pull/2344](https://togithub.com/vercel/swr/pull/2344) - feat: add all mutate options support to useSWRInfinite by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2350](https://togithub.com/vercel/swr/pull/2350) - ci: add publint to check packaging on CI by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/2363](https://togithub.com/vercel/swr/pull/2363) #### New Contributors - [@​IcedMonk](https://togithub.com/IcedMonk) made their first contribution in [https://github.com/vercel/swr/pull/2344](https://togithub.com/vercel/swr/pull/2344) **Full Changelog**: https://github.com/vercel/swr/compare/2.0.0...v2.0.1 ### [`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 ### [`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/s

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.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
crisis-news-map-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2023 9:48pm