Closed BrendonChirume closed 8 months ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/berzel/senza/8VN7TKhFa8MZZuwhkQdRFvsjk88x
✅ Preview: https://senza-git-snyk-upgrade-675d224411e9e2a73ed3654f5b6a4956-berzel.vercel.app
Snyk has created this PR to upgrade swr from 1.0.1 to 1.2.2.
As this is a private repository, Snyk-bot does not have access. Therefore, this PR has been created automatically, but appears to have been created by a real user. :sparkles: Snyk has automatically assigned this pull request, set who gets assigned.
:information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
Release notes
Package name: swr
Highlights of This Release
populateCache
Option Now Supports FunctionWe 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:The new definition:
Here is a demo for it: https://codesandbox.io/s/swr-basic-forked-hi9svh
Bug Fixes
What's Changed
populateCache
as a function by @ shuding in #1818Full Changelog: 1.2.1...1.2.2
Highlights of This Release
shouldRetryOnError
accepts a functionPreviously
shouldRetryOnError
is either true or false. Now it accepts a function that conditionally determines if SWR should retry. Here's a simple example:Thanks to @ sairajchouhan for contributing!
What's Changed
shouldRetryOnError
accepts a function that can be used to conditionally stop retrying by @ sairajchouhan in #1816New Contributors
Full Changelog: 1.2.0...1.2.1
What's Changed
New Contributors
Full Changelog: 1.1.2...1.2.0-beta.1
Highlights of This Release
Dedicated API for Optimistic Updates with Auto Rollback on Error
There are now some new options in
mutate
:Here the cache will be immediately updated to
user
, the “optimistic value”. And then a request (remote mutation) is started viapatchUser(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 currentmutate
APIs stay unchanged somutate(data, false)
works the same.Here's an example: https://codesandbox.io/s/swr-basic-forked-k5hps.
What's Changed
Full Changelog: 1.1.2...1.2.0-beta.0
What's Changed
requestAnimationFrame
more robust by @ thomaspaulmann in #1707New Contributors
Full Changelog: 1.1.1...1.1.2-beta.0
Commit messages
Package name: swr
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
🧐 View latest project report
👩💻 Set who automatically gets assigned
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs