marcobiedermann / spotify-clone

🎵 Simple Spotify clone using their Web API.
https://marcobiedermann-spotify-clone.netlify.com/
MIT License
4 stars 0 forks source link

chore(deps): bump swr from 0.5.7 to 1.2.2 #362

Closed dependabot[bot] closed 2 years ago

dependabot[bot] commented 2 years ago

Bumps swr from 0.5.7 to 1.2.2.

Release notes

Sourced from swr's releases.

1.2.2

Highlights of This Release

populateCache Option Now Supports Function

We added better Optimistic UI support in v1.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:

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:

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

Full Changelog: https://github.com/vercel/swr/compare/1.2.1...1.2.2

1.2.1

Highlights of This Release

shouldRetryOnError accepts a function

... (truncated)

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
codecov-commenter commented 2 years ago

Codecov Report

Merging #362 (8c42bb1) into main (20b8fa0) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #362   +/-   ##
=======================================
  Coverage   92.56%   92.56%           
=======================================
  Files          36       36           
  Lines         121      121           
  Branches       22       22           
=======================================
  Hits          112      112           
  Misses          9        9           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 20b8fa0...8c42bb1. Read the comment docs.

dependabot[bot] commented 2 years ago

Superseded by #381.