#Don't refetch if there is data in the query cache

5 messages · Page 1 of 1 (latest)

autumn brook
#

My goal is simply to not refetch a query if there exists data in the queryCache.

I am using a PersistQueryClientProvider which is successfully using the persisted query client from local storage when start the app. However, if there is data in the local storage related to that query I want to disable refetching on mount and in general.

#

I just want to use the data directly from the local storage which was then put in the query cache without any chance of a refetch

unborn crane
#

staleTime: Infinity

autumn brook
#

Interestingly enough doesn't work -

my query defaults:

refetchOnReconnect: false,
refetchOnWindowFocus: false,
refetchOnMount: false,
networkMode: 'online',
cacheTime: 0,
staleTime: Infinity,

and the query in question has a cacheTime of infinity

#

the query is initially not enabled, but then becomes enabled when certain prerequisite data becomes available. will this trigger a refetch?