Replies: 2 comments 1 reply
-
I'm afraid I'm not sure what the actual question is here. Can you clarify what you're trying to do and what isn't working? Code would help, or even better, a CodeSandbox or Replay recording that shows the issue. |
Beta Was this translation helpful? Give feedback.
-
Let me show more details A topic vote system like this
By default ,there are no condition for the topic list. will show all topics. We add a vote button in each item in the list. if user click the vote button, the votes will +1.
We trying to provide a better UX. so we choosed optimistic update. Updated the cache data first. give a quick response to user. if the api false will revert changes. It looks pretty good for now.
|
Beta Was this translation helpful? Give feedback.
-
We are trying to implement a topic list system, each topic can be voted by user.
We are using RTK query to fetch all topics. and trying to use optimistic update for vote feature to improve UX .
We updated the state in
onQueryStarted
no matter the api response is ok or not. to make sure when vote button clicked, the +1 will show up immediately.However, we have topic filter which could have many condition as query parameter, all the query results had been store in different parts.
We can not manual update all query result.......
I checked the official docs Tradeoff part
Looks it is a problem which we can not resolve now. :(
Beta Was this translation helpful? Give feedback.
All reactions