-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📝 Expand on implementing manual cache updates #1525
📝 Expand on implementing manual cache updates #1525
Conversation
- Add `Manual Cache Updates` page - Replace `Optimistic Updates` sidebar link with `Manual Cache Updates` link, and move closer to top - Move `Optimistic Updates` content to a recipe within `Manual Cache Updates` - Delete old unused `cache-management` page (replaced by `cache-management-utils`, but old one was accidentally left behind)
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 2670c15:
|
✔️ Deploy Preview for redux-starter-kit-docs ready! 🔨 Explore the source changes: 2670c15 🔍 Inspect the deploy log: https://app.netlify.com/sites/redux-starter-kit-docs/deploys/614a0b22e5fd020008bdab7b 😎 Browse the preview: https://deploy-preview-1525--redux-starter-kit-docs.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reads very well 🎉. Only one small suggestion, but can be discarded.
If we're removing old pages, can you add an entry into the |
Co-authored-by: Matt Sutkowski <[email protected]>
@markerikson no problem, all done for the FYI for clarity: I realised I said this in my commit message: |
@markerikson @phryneas I gave this another read and I'm good with it being merged 👍 |
I have some feedback about the pessimistic update example (https://redux-toolkit.js.org/rtk-query/usage/manual-cache-updates#pessimistic-updates). My feedback is based on two assumptions:
However, it seems that the example does not demonstrate this particular use case, due to the way It looks like the way to skip the server fetch for that use case would be to remove the Thoughts? |
Thanks @thedriveman, you're correct, neither the optimistic nor pessimistic examples should have If anything, the pessimistic update example could invalidate the |
Couldn't leaving out the tag invalidation raise problems in some edge cases like mentioned here #1529 ? In the case of the example, if the GET request for the post failed or returns successfully but with a falsy body (eg null and false are valid json), then manual cache updates won't work, since it requires data to exist in the cache for the manual update to occur. I know, these are edge cases, but I could see some people bumping into these sorts of issues (like me :D) |
Manual Cache Updates
pageOptimistic Updates
sidebar link withManual Cache Updates
link, and move closer to topOptimistic Updates
content to a recipe withinManual Cache Updates
cache-management
page(replaced by
cache-management-utils
, but old onewas accidentally left behind)
The purpose of this PR is to more explicitly advertise how to perform 'manual cache updates' in a number of ways, rather than specifically 'optimistic updates' only. This should hopefully make it easier both for: