Skip to content
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

[v3] useQuery with suspense doesn't use cache data on mount #1249

Closed
s-bilous opened this issue Nov 3, 2020 · 2 comments
Closed

[v3] useQuery with suspense doesn't use cache data on mount #1249

s-bilous opened this issue Nov 3, 2020 · 2 comments

Comments

@s-bilous
Copy link

s-bilous commented Nov 3, 2020

Describe the bug
When the useQuery is being unmounted and mounted again, it throws suspense even if cacheTime wasn't expired.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/nice-firefly-b50jc?file=/src/App.js
  2. Tap on 'Hide time' button
  3. Wait for 2 seconds (default staleTime)
  4. Tap on 'Show time' button
  5. Loading indicator appeared instead of a previously cached result

Expected behavior
I'd expect the behavior described in the documentation:

The query immediately returns the available cached value while the fetchTodos function is being run in the background to populate the query with a fresh value.
@tannerlinsley
Copy link
Collaborator

Tracking this in #1160 and #1059

@boschni
Copy link
Collaborator

boschni commented Nov 7, 2020

Thanks for reporting! Fixed in 3.2.0-beta.21

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

No branches or pull requests

3 participants