Skip to content
Source
Sign inSign up
TanStack/db

fix(electric): cancel bounded refresh waits #1776

ClosedKyleAMathews(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromcodex/electric-bounded-waitopened

Showing 3 changed files with 39 additions and 5 deletions (loading 1).

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/cancel-electric-refresh-wait.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/electric-db-collection': patch
+---
+​
+Cancel an on-demand refresh wait when its request or collection is cleaned up, preventing snapshots from starting after teardown.
34 additions and 5 deletionspackages/electric-db-collection/src/electric.tsModified
View file
@@ -579,18 +579,21 @@
​
const loadSubset = async (opts: LoadSubsetOptions) => {
const commitCursor = getCommitCursor()
- if (opts.signal?.aborted) return
+ const isAborted = (): boolean =>
+ signal.aborted || opts.signal?.aborted === true
+ if (isAborted()) return
Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
​