Next.js Discord

Discord Forum

revalidatePath, not working. stale data, hello stress!

Unanswered
Bonaparte's Gull posted this in #help-forum
Open in Discord
Bonaparte's GullOP
Are people really using the app router in production?!
I don't mean to be rude.. but wtf.

25 Replies

Bonaparte's GullOP
It's default and wanted behavior.
https://youtu.be/FZTaD32ueE8?si=mjfNv_9r1ILgbMh0&t=577

If you still facing an issue with fetching... Tore also mentioned that and also fixed it. You might want to take a look here: https://nextjs-forum.com/post/1178068479228784680#message-1178072769653653544
Bonaparte's GullOP
so the default and desired behaviour is to show stale data.
i've hit refresh about 200 times, opened the page in a new window, incognito, et al.
bonkers!
i've got a page showing data that was deleted literally weeks ago!
from the docs:
revalidatePath only invalidates the cache when the included path is next visited. This means calling revalidatePath with a dynamic route segment will not immediately trigger many revalidations at once. The invalidation only happens when the path is next visited.

something must be broken somewhere, cos i'm not having this experience
that video is using the pages router
I have similar issue. Using revalidateTag before the fetch request (triggered after a specific condition) doesn't to anything. I still get the old rendered page. This is the most confusing thing I've ever seen in my decade of exp....
Bonaparte's GullOP
snap! i feel like i've just started dev.
been using next for 4 years... loved the pages router... but me oh my... this app router sure is a funked
I redirect the user to a dynamic route (it has export const dynamic = 'force-dynamic') using router.push(newRoute) and the server is not even reached (I don't see any logs). I get a cached page. 🤦‍♂️
Bonaparte's GullOP
yeah... sod this, i'm switching to the pages router
thinking about this. But it requires way to much work from our side 😞
we are thinking about moving only this one page we have problems with
Bonaparte's GullOP
oofh... luckily i've only just started this project
We are 1 year into the project. Got really complex
Bonaparte's GullOP
ouch
does using "use client" all over the place make any difference?
i guess not!
I can't use it becaue my component redirects to another page using redirect(). And that's a server function
@ionel lupu I redirect the user to a dynamic route (it has `export const dynamic = 'force-dynamic'`) using router.push(newRoute) and the server is not even reached (I don't see any logs). I get a cached page. 🤦‍♂️
Black Caiman
This is because the user likely has the page cached in the “router cache”. Does it work if you call router.refresh()? That should invalidate the client side router cache and force a new request to the server.
Bonaparte's GullOP
alas router.refresh() doesn't solve the revalidate issue. I need to be able to revalidate data based on changes in my cms.