You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: While optimistic mutations are waiting for results from the API all queries that may alter our optimistic data are paused (or rather queued up) and all optimistic mutations will be reverted at the same time. This means that optimistic results can stack but will never accidentally be confused with "real" data in your configuration.
I sometimes encounter a situation where I don’t need to execute a mutation (I filter it out from operations$), which results in some mutations that were marked as optimistic not being completed. As a result, I see the optimistic version of the cache instead of the real one. Is there a way to triger manually reverting of the optimistic updates?
I have deeply nested structure and let's take for example 2 mutatuions one create child and another one deletes item
Create 1
Create child 1_1
Create child 1_1_1
Delete 1_1
While Create child 1_1 wasn't started when Delete 1_1 launched I'm removing all of them
create child 1_1
Create child 1_1_1
Delete 1_1
then after recieving response for Create 1 I wanna get reall cache, right now I have the data from optimistic update instead of having "real" from the response.
In cases where I let all the requests go through, the cache eventually updates with the real data. However, I would like to avoid unnecessary requests.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Here
I've found that fancy notes\
I sometimes encounter a situation where I don’t need to execute a mutation (I filter it out from operations$), which results in some mutations that were marked as optimistic not being completed. As a result, I see the optimistic version of the cache instead of the real one. Is there a way to triger manually reverting of the optimistic updates?
I have deeply nested structure and let's take for example 2 mutatuions one create child and another one deletes item
Create 1
Create child 1_1
Create child 1_1_1
Delete 1_1
While Create child 1_1 wasn't started when Delete 1_1 launched I'm removing all of them
create child 1_1
Create child 1_1_1
Delete 1_1
then after recieving response for Create 1 I wanna get reall cache, right now I have the data from optimistic update instead of having "real" from the response.
In cases where I let all the requests go through, the cache eventually updates with the real data. However, I would like to avoid unnecessary requests.
Beta Was this translation helpful? Give feedback.
All reactions