Skip to content
Source
Sign inSign up
TanStack/db

fix: invalidate stale predicate-scoped cache entries on manual-sync writes #1497

Closedmarbemac(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/1497/headopened

Showing 5 changed files with 26 additions and 18 deletions (loading 2).

x
0 of 5 viewed, 5 left
5 additions and 0 deletions.changeset/fix-cache-poisoning-on-manual-writes.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/query-db-collection': patch
+---
+​
+Prevent on-demand manual-sync writes from replacing predicate, order, or pagination cache entries with the full synced snapshot. Refetch active enabled entries and remove inactive or disabled entries, while eager collections still patch their full-result cache.
14 additions and 12 deletionsdocs/collections/query-collection.mdModified
View file
@@ -314,9 +314,9 @@
​
If a stale initial response triggers a fetch, the initial rows remain available
while it is in flight. A successful response reconciles them through the normal
-row ownership pipeline; an error retains the initial rows. Direct writes use the
-same Query cache-patching rules as fetched data, and a later successful server
-response may reconcile or replace those writes.
+row ownership pipeline; an error retains the initial rows. Direct writes patch
+the eager Query cache in place, and a later successful server response may
+reconcile or replace those writes.
​
### Selecting Rows from Wrapped Responses
​
@@ -356,7 +356,7 @@
​