Roedt / ringesentralen-frontend

Frontend for ringesentralen
MIT License
2 stars 0 forks source link

Update dependency swr to v1.3.0 #445

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) 1.2.1 -> 1.3.0 age adoption passing confidence

Release Notes

vercel/swr ### [`v1.3.0`](https://togithub.com/vercel/swr/releases/tag/1.3.0) [Compare Source](https://togithub.com/vercel/swr/compare/1.2.2...1.3.0) #### What's Changed - type: fix type error on SWRConfig by [@​Himself65](https://togithub.com/Himself65) in [#​1913](https://togithub.com/vercel/swr/issues/1913) - chore: update React 18 dependencies by [@​shuding](https://togithub.com/shuding) in [#​1824](https://togithub.com/vercel/swr/issues/1824) - test: fix an act warning by [@​koba04](https://togithub.com/koba04) in [#​1888](https://togithub.com/vercel/swr/issues/1888) - feat: support functional optimisticData by [@​huozhi](https://togithub.com/huozhi) in [#​1861](https://togithub.com/vercel/swr/issues/1861) - bugfix: make suspense and revalidateIfStale work together by [@​simowe](https://togithub.com/simowe) in [#​1851](https://togithub.com/vercel/swr/issues/1851) **Full Changelog**: https://github.com/vercel/swr/compare/1.2.2...1.3.0 ### [`v1.2.2`](https://togithub.com/vercel/swr/releases/tag/1.2.2) [Compare Source](https://togithub.com/vercel/swr/compare/1.2.1...1.2.2) #### Highlights of This Release ##### `populateCache` Option Now Supports Function We added better Optimistic UI support in [v1.2.0](https://togithub.com/vercel/swr/releases/tag/1.2.0). However, what if your API is only returning a subset of the data (such as the mutated part), that can be populated into the cache? Usually, an extra revalidation after that mutation is needed. But now you can also use a function as `populateCache` to transform the mutate result into the full data: ```js await mutate(addTodo(newTodo), { optimisticData: [...data, newTodo], rollbackOnError: true, populateCache: (addedTodo, currentData) => { // `addedTodo` is what the API returns. It's not // returning a list of all current todos but only // the new added one. // In this case, we can transform the mutate result // together with current data, into the new data // that can be updated. return [...currentData, addedTodo]; }, // Since the API already gives us the updated information, // we don't need to revalidate here. revalidate: false, }); ``` The new definition: ```ts populateCache?: boolean | ((mutationResult: any, currentData: Data) => Data) ``` Here is a demo for it: https://codesandbox.io/s/swr-basic-forked-hi9svh ##### Bug Fixes #### What's Changed - refactor: revalidateIfStale has an effect on updates, not only mounting by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1837](https://togithub.com/vercel/swr/pull/1837) - fix: reset stale unmountedRef in suspense by [@​promer94](https://togithub.com/promer94) in [https://github.com/vercel/swr/pull/1843](https://togithub.com/vercel/swr/pull/1843) - test: add a test for the behavior of revalidateOnMount when the key has been changed by [@​koba04](https://togithub.com/koba04) in [https://github.com/vercel/swr/pull/1847](https://togithub.com/vercel/swr/pull/1847) - feat: Support `populateCache` as a function by [@​shuding](https://togithub.com/shuding) in [https://github.com/vercel/swr/pull/1818](https://togithub.com/vercel/swr/pull/1818) **Full Changelog**: https://github.com/vercel/swr/compare/1.2.1...1.2.2

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.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication