All Questions
Tagged with react-query caching
38
questions
0
votes
0
answers
15
views
NextJS Server Component Data Mutation
'use server';
import TirestockComponent from '@components/TirestockComponent';
import { fetchTirestock } from '@nextapi/fetchTirestock';
export default async function UsedTirestock() {
const ...
0
votes
0
answers
29
views
getServerSideProps with ReactQuery doesn't cache properly
im using nextjs 14.2.3 (page router) with react query, and my data is not cached when im trying to call an api on the server with getServerSideProps with reactQuery.
when ever i change my route, the ...
0
votes
0
answers
63
views
React query not updating data even after refetch shows new data from api
I am using react query to fetch a list of items. After creating a new item, I am calling refetch on my query to get the updated list. I see a new api call is made, and the new item I just created is ...
0
votes
0
answers
14
views
React Query - Not Caching API Response
Problem:
Trying to get caching working with react-query. The code seems to be correct as I'm using both staleTime and cacheTime, but it keeps re-fetching data every after page reload. It's not ...
0
votes
0
answers
40
views
What are the exact react query overheads?
Does using react query introduce overhead of timers since it has to keep track of stale time, garbage collection on milliseconds precision?
Does it provide cache max limit size based on max number of ...
1
vote
0
answers
103
views
Dev tool for Next.js cache on the client?
React Query has this handy dev tool react-query-devtools to keep track of whether a piece of cached data is fresh, stale, is being fetched, etc., and it even gives you manual control to initiate cache ...
0
votes
0
answers
69
views
React Query CacheTime ignored in React Native
I am trying to prefetch some data on the home screen to display on a different screen (search screen) when the user goes there. I'm trying to set the cacheTime to be 24 hours, so it will basically ...
1
vote
0
answers
74
views
What is the best way to manage fetched data in NextJS 13, or above, using the App router?
Context:
I developed a website using Next13 (now updated to 14), for an educational institution, where the user is presented to a landing page with a login form. After the login, the user can access ...
0
votes
1
answer
43
views
why my query does not read cache when component mounted and every time component load?
for first time component that has query inside it when mounted , a loading show in the page and when data received data showed . so cache time of data is 5 minutes . I go to another route and very ...
0
votes
3
answers
6k
views
How to keep previous data when refetching multiple times using React Query?
I've implemented a custom React hook creates a task on my API, stores the task UUID in state and then starts polling the API every 2 seconds until successful data is received.
The problem I'm facing ...
0
votes
0
answers
254
views
React Query performance issue
I am using React Query in my React app, when I using enabled option to tell a query when it is ready to run, it is still persists to the cache as disabled even if this query not execute. I wonder if ...
0
votes
3
answers
5k
views
How to store data that comes from react-query in local-storage
I was attempting to store the data from react-query in local storage so that it persists when the page is reloaded. However, I encountered an error stating that the JSON format is invalid.
const [...
0
votes
1
answer
2k
views
Why is my react-query configuration fetching from cache?
I'm migrating a legacy codebase from saga (no cache) to react-query. My starting point is to replicate exactly as we have now, a very unoptimised approach, and optimise later, enabling cache piece by ...
1
vote
2
answers
2k
views
How to normalize react-query cache to only use a single key when there are multiple keys?
My useQuery is calling an API (/posts/:idOrSlug where each resource can be identified by either one of two keys - an ID or a slug. Initially the frontend only has the slug but not the ID, but the ...
4
votes
1
answer
2k
views
Using Cache-Control header with react-query
I was wondering whether react-query take Cache-Control header coming from the server into consideration.
I want to set the staleTime based on the instructions coming from the server about how long ...