fix(useBaseQuery): set cacheTime to 1 in Suspense mode when cacheTime is set to 0 #2821
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.
It prevents infinite loop when
cacheTimeis set to0in Suspense mode.cacheTimeis now set to1in this case.Closes #2367
Also added a section in Testing documentation section related to #1847 (
Infinityis used instead of0to prevent infinite loop for React Query versions without this fix).This fix is a simple solution to prevent infinite loop when
cacheTimeis set to0but more investigations should be needed about Suspense mode support.For information, the bug is related to the
optionalRemove()call below:https://github.com/tannerlinsley/react-query/blob/e6da990703482cff8ea99f5a254975cb57463ed5/src/core/query.ts#L432-L435