duplicated invalidate sent in very close time, how to maintain the order #8491
Replies: 1 comment
-
A good idea is to only invalidate in
The check for This way, when you have concurrent mutations, you will ensure that only one invalidation runs at the very end of the chain, and you avoid those in-between invalidations that you likely don’t want. And if another mutation starts after the last mutation triggered an invalidation, the cancelation in Note that I’m also returning the result of the query invalidation. This makes sure that the mutation stays in pending state while the invalidation is still going on. |
Beta Was this translation helpful? Give feedback.
-
I have a sheet app optimistic updating value in "cell" by the following function, it will:
cell
atposition
of functiontable.getCells({ tableId })
table.getCells({ tableId })
Now, let's say the network is pretty slow and we have 4 mutation requests (mutate the cell at position: col = 1, row = 0) in order:
mutation #91
)mutation #92
)mutation #93
)mutation #94
)I EXPECT to always see
1234
at the cell finally. But I saw12
at the end in very slow network environment. Here is the log:I believe the reason that seeing
12
not1234
at the end is somehowquery #73
with the cell value12
is the last response among all queries?Could anyone tell me how to solve this problem (always return the last mutated value like
1234
)Btw, the last value in database is
12
not1234
Beta Was this translation helpful? Give feedback.
All reactions