Skip to content

Conversation

@anhthien-bic
Copy link
Contributor

@anhthien-bic anhthien-bic commented Jan 5, 2023

I read the current documentation that there is no mention of the default value of refetchOnWindowFocus, and the current way of writing it makes me re-verify that only refetch when the data is stale, it took me 15 minutes to read the code to verify how it works, so I want to update the docs for more clear.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 5, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@TkDodo
Copy link
Collaborator

TkDodo commented Jan 5, 2023

It is covered in the important defaults page:

Stale queries are refetched automatically in the background when:

  • New instances of the query mount
  • The window is refocused
  • The network is reconnected
  • The query is optionally configured with a refetch interval

I don't mind merging this addition, but it's important to understand the general concepts. As long as data is considered "fresh" (NOT stale), you will always only read data from the cache and none of the events will trigger a background refetch.

@TkDodo TkDodo merged commit 6ad7441 into TanStack:main Jan 5, 2023
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