-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Infinite loop when to Suspense mode with cacheTime: 0 #2367
Comments
confirmed. I first thought it has something to do with |
Temporarily to solve this issue I'm using |
Reproduced the issue with Suspense while testing with jest and set the |
should we have this workaround built-in? We have something similar for staleTime and suspense: It seems similar, so we could set |
Is it fine to use a cacheTime of 1? It will not randomly do infinite loops from time to time? |
cacheTime of 1 means unused items will be removed from the cache after 1ms, while 0 means they will be removed instantly. I think the distinction is irrelevant for most cases. Also, cacheTime defaults to 5 minutes, so this only covers cases where it was purposefully set to zero |
It's a patch that we'll prevent infinite loops with |
would you like to contribute it? |
@TkDodo Sure!, both code and docs? |
@arnaudbzn yes please :) |
🎉 This issue has been resolved in version 3.28.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Describe the bug
Suspense mode does not working when to set
cacheTime: 0
, data will never resolve and infinite loop API call.I just fork example from https://react-query.tanstack.com/guides/suspense and add
cacheTime: 0
option.To Reproduce
https://codesandbox.io/s/confident-darwin-6oz9t?file=/src/index.js
Steps to reproduce the behavior:
Network
tabScreenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: