Replies: 1 comment 4 replies
-
You can do optimistic updates if you want to: https://redux-toolkit.js.org/rtk-query/usage/manual-cache-updates#optimistic-updates But RTK is specifically designed around the idea that "the server is the source of truth", and so it will re-fetch the data after update when the endpoint is invalidated. Afraid I don't understand the second question. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I am new to the rtk query structure. In the example in its document, in my example, it sends a fetch request again after the mutation operation, shouldn't it instead update the data in the cach?
https://codesandbox.io/s/github/reduxjs/redux-toolkit/tree/master/examples/query/react/mutations?from-embed
For example, after editing the todo, it sends a request to the todos endpoint again.
Another question is, I have users and user search endpoint. They both look at 2 different queries, but the result they bring is the same, someone just returns the filtered result. In an example scenario, searchte is user_name: Jhon, and users all queries are in the form of jhon. Can I change the current value of the id of that last user from the cache? In providesTags, both queries have the same type and id, but it does not work.
Beta Was this translation helpful? Give feedback.
All reactions