Skip to content

keepUnusedDataFor vs refetchOnMountOrArgChange #1484

Answered by phryneas
viniciusbsneto asked this question in Q&A
Discussion options

You must be logged in to vote

keepUnusedDataFor: Imagine you unmount your last component using useMyQuery(5). After keepUnusedDataFor seconds, the cache value will now be deleted from cache.

refetchOnMountOrArgChange: Imagine you already have a component using useMyQuery(5). Now a new component mounts and also uses useMyQuery(5). Normally, that data would not refetch. If refetchOnMountOrArgChange is set and more time than that value has passed when that new component mounts, it will re-fetch even though a result is already in the cache.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@viniciusbsneto
Comment options

Answer selected by viniciusbsneto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants