diff --git a/.changeset/fast-mirrors-wait.md b/.changeset/fast-mirrors-wait.md deleted file mode 100644 index 92fabf7bf..000000000 --- a/.changeset/fast-mirrors-wait.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@tanstack/electric-db-collection': patch ---- - -Fix slow onInsert awaitMatch performance issue - -The message buffer was being cleared at the start of each new batch, causing messages to be lost when multiple batches (including heartbeats) arrived before `awaitMatch` was called. This resulted in `awaitMatch` timing out (~3-5s per attempt) and transaction rollbacks. - -The fix removes the buffer clearing between batches. Messages are now preserved until the buffer reaches MAX_BATCH_MESSAGES (1000), at which point the oldest messages are dropped. This ensures `awaitMatch` can find messages even when sync activity arrives before the API call completes. diff --git a/packages/electric-db-collection/CHANGELOG.md b/packages/electric-db-collection/CHANGELOG.md index eb184bf76..258964695 100644 --- a/packages/electric-db-collection/CHANGELOG.md +++ b/packages/electric-db-collection/CHANGELOG.md @@ -1,5 +1,15 @@ # @tanstack/electric-db-collection +## 0.2.19 + +### Patch Changes + +- Fix slow onInsert awaitMatch performance issue ([#1062](https://github.com/TanStack/db/pull/1062)) + + The message buffer was being cleared at the start of each new batch, causing messages to be lost when multiple batches (including heartbeats) arrived before `awaitMatch` was called. This resulted in `awaitMatch` timing out (~3-5s per attempt) and transaction rollbacks. + + The fix removes the buffer clearing between batches. Messages are now preserved until the buffer reaches MAX_BATCH_MESSAGES (1000), at which point the oldest messages are dropped. This ensures `awaitMatch` can find messages even when sync activity arrives before the API call completes. + ## 0.2.18 ### Patch Changes diff --git a/packages/electric-db-collection/package.json b/packages/electric-db-collection/package.json index 6a1c21104..54774cfe0 100644 --- a/packages/electric-db-collection/package.json +++ b/packages/electric-db-collection/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/electric-db-collection", - "version": "0.2.18", + "version": "0.2.19", "description": "ElectricSQL collection for TanStack DB", "author": "Kyle Mathews", "license": "MIT",