[repro] writeUpdate persists on remount for on-demand collections (issue #1152)#1154
Closed
claude[bot] wants to merge 2 commits intomainfrom
Closed
[repro] writeUpdate persists on remount for on-demand collections (issue #1152)#1154claude[bot] wants to merge 2 commits intomainfrom
claude[bot] wants to merge 2 commits intomainfrom
Conversation
…s (issue #1152) Add tests that verify writeUpdate on on-demand collections with computed query keys properly updates all active query caches so data persists when components remount. Tests cover three scenarios: 1. Function-based computed queryKey with predicates 2. Static queryKey with on-demand mode and where clause 3. Function queryKey that returns constant value These tests currently fail, demonstrating the bug where writeUpdate updates the wrong cache key (base key instead of predicate-specific keys). Co-Authored-By: Claude <noreply@anthropic.com>
|
This was referenced Jan 19, 2026
Merged
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: |
Contributor
|
Size Change: 0 B Total Size: 90.5 kB ℹ️ View Unchanged
|
Contributor
|
Size Change: 0 B Total Size: 3.47 kB ℹ️ View Unchanged
|
Contributor
|
Closing this one as we will merge the fix (#1155) which includes this reproduction straight into main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reproduction test for issue #1152.
Adds tests that verify
writeUpdateon on-demand collections with computed query keys properly updates all active query caches so data persists when components remount.Tests cover three scenarios:
queryKey: (opts) => [...]where the key changes based on predicatesqueryKey: ['collection']but predicates get appended in on-demand modequeryKey: () => ['collection'](constant)How to run:
Observed failure:
2 out of 3 tests fail with:
This demonstrates that after using
writeUpdateand then remounting (cleanup + recreate live query), the updated data is lost because the cache was updated at the wrong query key.What the tests assert:
collection.utils.writeUpdate()on an itemFixes: #1152