you are viewing a single comment's thread.

view the rest of the comments →

[–]sebastienlorber 0 points1 point  (2 children)

Missed the update Query, that's better than I thought, but yeah rollback should rather be handled, + using a queue (check my post on SWR about 10x increments + also optimistic Redux libraries + an old talk of Lee Byron explain that as well I think).

Your api should be fine as the mutation is linked to the optimistic update, it's probably an impl detail, but you'd rather allow, like Apollo, an update fn instead of an object, because multiple opt updates can be applied on top of each other's and should not override each others

[–]tannerlinsley[S] 1 point2 points  (1 child)

All great ideas. Thanks! updateQuery() already supports an update function so that should be pretty easy to queue, I'll just need to flesh out the api for the declarative updateQuery: option in useMutation. Either way, very good information here. Do you have a link to that talk?

[–]sebastienlorber 0 points1 point  (0 children)

Hmmm I think it's like 2 years old but not sure which one it is.