Mutations that should cancel each other out (create + immediate delete)? #991
Unanswered
christianalares
asked this question in
Q&A
Replies: 1 comment
-
|
Those merges only appear within a given transaction, they are not cross-transaction. The function you are talking about can be seen here: db/packages/db/src/transactions.ts Lines 24 to 42 in 5eb8300 I don't know your use case but I can share mine. With the offline-transactions package, I can persist the transactions and replay them when the network comes back. I then group mutations by globalKey and merge them sequentially using mergePendingMutations through the beforeRetry interface. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey all! I'm trying to learn how the cancellation of mutations in the collection works. Currently I get race conditions if a quickly add a record and delete it immediately since the record does not exist in the db yet when trying to delete it. I've read this in the docs:
However to my understanding in this repro, the insertion and deletion is made in two different transaction, but I cant find the correct way to deal with this?
Here is a repro:
https://github.com/christianalares/tanstack-db-race-condition-repro
Beta Was this translation helpful? Give feedback.
All reactions