-
Notifications
You must be signed in to change notification settings - Fork 132
Add timeout support to electric-db-collection #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add timeout support to electric-db-collection #798
Conversation
This change allows users to specify a custom timeout when returning txids from mutation handlers (onInsert, onUpdate, onDelete). Previously, users could only customize timeouts when manually calling collection.utils.awaitTxId(), but not when using the automatic txid matching strategy via electricCollectionOptions. Changes: - Updated MatchingStrategy type to include optional timeout property - Modified processMatchingStrategy to extract and pass timeout to awaitTxId - Added documentation example showing how to use custom timeout - Updated JSDoc comments for mutation handlers This addresses the feature request in GitHub discussion #794. Default timeout remains 5000ms when not specified.
🦋 Changeset detectedLatest commit: fa9c3f3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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: |
|
Size Change: 0 B Total Size: 86 kB ℹ️ View Unchanged
|
- Add new test to verify custom timeout in matching strategy - Test ensures timeout is properly passed to awaitTxId and triggers timeout error - Add changeset documenting the new timeout feature as a minor release All 60 tests passing including the new timeout test.
|
Size Change: 0 B Total Size: 3.34 kB ℹ️ View Unchanged
|
b1dc988 to
893acda
Compare
|
docs generation is being odd removing the links @kevin-dp any idea why that would happen? It just popped up in all the PRs today. |
samwillis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolved conflicts: - packages/electric-db-collection/src/electric.ts: Combined timeout support with arrow function fix for array txids - packages/electric-db-collection/tests/electric.test.ts: Added both custom timeout test and array txid test The merge includes PR #795 which fixes array txid handling and is fully compatible with our timeout support feature. Our implementation passes the timeout parameter correctly to awaitTxId for both single and array cases.
|
🎉 This PR has been released! Thank you for your contribution! |
This change allows users to specify a custom timeout when returning txids from mutation handlers (onInsert, onUpdate, onDelete).
Previously, users could only customize timeouts when manually calling collection.utils.awaitTxId(), but not when using the automatic txid matching strategy via electricCollectionOptions.
Changes:
This addresses the feature request in GitHub discussion #794.
Default timeout remains 5000ms when not specified.
🎯 Changes
✅ Checklist
pnpm test:pr.🚀 Release Impact