Skip to content

Update dependency swr to v1.3.0 - abandoned#122

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/swr-1.x
Open

Update dependency swr to v1.3.0 - abandoned#122
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/swr-1.x

Conversation

@renovate

@renovate renovate Bot commented May 1, 2022

Copy link
Copy Markdown

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
swr (source) 1.2.0 -> 1.3.0 age adoption passing confidence

Release Notes

vercel/swr

v1.3.0

Compare Source

What's Changed

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

v1.2.2

Compare Source

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: vercel/swr@1.2.1...1.2.2

v1.2.1

Compare Source

Highlights of This Release

shouldRetryOnError accepts a function

Previously shouldRetryOnError is either true or false. Now it accepts a function that conditionally determines if SWR should retry. Here's a simple example:

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 for contributing!

What's Changed

New Contributors

Full Changelog: vercel/swr@1.2.0...1.2.1


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.

@vercel

vercel Bot commented May 1, 2022

Copy link
Copy Markdown

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

1 Ignored Deployment
Name Status Preview Updated
website ⬜️ Ignored (Inspect) May 1, 2022 at 9:54AM (UTC)

@renovate

renovate Bot commented Mar 23, 2023

Copy link
Copy Markdown
Author

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@renovate

renovate Bot commented Dec 8, 2024

Copy link
Copy Markdown
Author

Autoclosing Skipped

This PR has been flagged for autoclosing. However, it is being skipped due to the branch being already modified. Please close/delete it manually or report a bug if you think this is in error.

@renovate renovate Bot changed the title Update dependency swr to v1.3.0 Update dependency swr to v1.3.0 - abandoned Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant