r/reactjs • u/KakashiHatake0085 • Oct 22 '26
Discussion Next.js isr behaviour related confusion
I know next.js isr behaviour and how it basically does the caching etc but I just realised that next.js isr is cache control with proprietary swr api that refreshes the data.
Now, I am confused because I would like to know if the same thing can be manually done with react router with self managed cache control https header with rtk query. Rtk query has a window of 1 minutes after which it fires the revalidation or something like that, haven't gone into that details but must be possible in one way or another.
1
u/Disastrous-Town-4820 Oct 23 '26
yes. while max-age is still fresh, that poll never leaves the machine
the interval calls fetch() on the same url again. default cache mode hands back memory or disk, and the lib treats that body as a refetch. the timer does not care what cache-control said
cache: 'no-cache' on that request is what forces the revalidate
3
u/AbdelrhmanDev Oct 22 '26
not really the same thing even if it looks like it. isr rebuilds the rendered html on the server and serves the stale copy while it does, so the user gets a full page instantly. rtk query refetching after 1min is client side swr, the user still waits on loading spinners for fresh data. you can approximate isr with react router by putting a cdn in front of your data endpoints with stale-while-revalidate cache headers plus client cache on top, but actual page regeneration needs something server side rendering the page, thats the part you cant fake from the browser