feat: handle delete-insert in transaction merging#1068
feat: handle delete-insert in transaction merging#1068marbemac wants to merge 2 commits intoTanStack:mainfrom
Conversation
Signed-off-by: Marc MacLeod <marbemac+gh@gmail.com>
🦋 Changeset detectedLatest commit: 1cf246c The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Tests failing with: But only in CI - works on my local machine. Let me know if there's something I should do to resolve them! |
|
Hey @marbemac This looks ok to me, but @KyleAMathews should cast his eyes over it as he spent some time working through the logic around handing these overlapping mutations in a transaction. CI does a soft merge on main when it runs, and it was main that was broken (due to a new check being added)... CI is now green. |
|
hi team, just following up here to see if this is still something ya'll might consider? |
🎯 Changes
So related to the whole longer lived editing session concept, running into delete and the insert issue on pending mutation. Basically if user deletes something in our editor, we tx.mutate and delete the record. Then if the user cmd+z to undo in our editor, we reverse the operation and insert the record that was just deleted (on same tx, it has not been committed yet).
This pattern results in the Uncaught Error: Unhandled mutation combination: delete-insert error.
This PR adds handling for delete-insert pattern.
✅ Checklist
pnpm test:pr.🚀 Release Impact