Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Bump swr from 0.5.6 to 1.3.0#80

Closed
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/npm_and_yarn/swr-1.3.0
Closed

Bump swr from 0.5.6 to 1.3.0#80
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/npm_and_yarn/swr-1.3.0

Conversation

@dependabot
Copy link

@dependabot dependabot bot commented on behalf of github May 1, 2022

Bumps swr from 0.5.6 to 1.3.0.

Release notes

Sourced from swr's releases.

1.3.0

What's Changed

Full Changelog: vercel/swr@1.2.2...1.3.0

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

... (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)

Bumps [swr](https://github.com/vercel/swr) from 0.5.6 to 1.3.0.
- [Release notes](https://github.com/vercel/swr/releases)
- [Commits](vercel/swr@0.5.6...1.3.0)

---
updated-dependencies:
- dependency-name: swr
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label May 1, 2022
@dependabot dependabot bot mentioned this pull request May 1, 2022
@vercel
Copy link

vercel bot commented May 1, 2022

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

Name Status Preview Updated
population-graph ✅ Ready (Inspect) Visit Preview May 1, 2022 at 3:03AM (UTC)

@dependabot @github
Copy link
Author

dependabot bot commented on behalf of github Jan 1, 2023

Superseded by #119.

@dependabot dependabot bot closed this Jan 1, 2023
@dependabot dependabot bot deleted the dependabot/npm_and_yarn/swr-1.3.0 branch January 1, 2023 03:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants