Skip to content

Test garbage collection of queries without data #175

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

Merged
merged 3 commits into from
Feb 29, 2020

Conversation

cherniavskii
Copy link
Contributor

Tests this piece of code:
https://github.com/tannerlinsley/react-query/blob/213df4a4fd87b705789c09d6eb63491e6c7b74c7/src/queryCache.js#L209-L219

Test fails, when cache timeout is set to query.config.cacheTime, i.e.:

 query.scheduleGarbageCollection = () => { 
   query.cacheTimeout = setTimeout( 
     () => { 
       cache.removeQueries(d => d.queryHash === query.queryHash) 
     }, 
-     typeof query.state.data === 'undefined' && 
-       query.state.status !== 'error' 
-       ? 0 
-       : query.config.cacheTime
+      query.config.cacheTime 
   ) 
 } 

@tannerlinsley tannerlinsley merged commit 3724af2 into TanStack:master Feb 29, 2020
@cherniavskii cherniavskii deleted the garbage-collection-test branch February 29, 2020 17:02
Copy link

nx-cloud bot commented May 9, 2024

View your CI Pipeline Execution ↗ for commit 387386d.

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2s View ↗
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-05-18 20:01:58 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants