Don't evict query keys from cache#903
Closed
kevin-dp wants to merge 6 commits into
Closed
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
fix: remove auto-merge from docs PR in release workflow The docs generation CI job after releases was failing because it tried to immediately merge the PR, but tests need to run first. Now the workflow just creates the PR and lets it go through normal CI checks before manual merge. Co-authored-by: Claude <noreply@anthropic.com>
|
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: 86.3 kB ℹ️ View Unchanged
|
Contributor
|
Size Change: 0 B Total Size: 3.34 kB ℹ️ View Unchanged
|
kevin-dp
force-pushed
the
kevin/do-not-evict-query-keys-from-cache
branch
2 times, most recently
from
November 25, 2025 11:00
d926e09 to
a358d7a
Compare
kevin-dp
force-pushed
the
kevin/do-not-evict-query-keys-from-cache
branch
from
November 25, 2025 11:12
a358d7a to
f632eef
Compare
Contributor
Author
|
Closed in favor of #905 |
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.
When a live query is GCed its subscription is unsubscribed and the Query collection then immediately tells tanstack/query to remove the corresponding query keys. However, this means that the query data is immediately GCed. So if a user quickly browses to another page and comes back the data has to load again because it was immediately GCed on onmount. We should not evict it immediately but simply delete the tanstack/query observer such that tanstack/query will GC the data after the cache time has elapsed.
#870 fixes this but it also introduces a couple of other changes that may not be needed. I removed the commits from that PR to see if we can fix this problem more surgically.