Next.js Discord

Discord Forum

next js serving old data

Unanswered
wWHYSOSERIOUSs posted this in #help-forum
Open in Discord
i am getting data of pervious user which i logged out of in the current user
on all pages unless i refresh the page
im using react query with axios

i guess its a caching issue , on my page im exporting revalidate = 0 yet the issue is the same

13 Replies

even reading from localstorage
im getting old data
im reading fullname

which is of previous logged out user
i am using force-dynamic
but im already using dynamic import on the page lol

how do i get around this
doesnt work
ok i applied this on my rool layout
even now i get old data
how do idsable cache globally if im using axios ?
Border Terrier
stop using axios, just use fetch its better (https://adios-axios.com/)
@Border Terrier stop using axios, just use fetch its better (https://adios-axios.com/)
but why my localstorage is also outdated ?
American Sable
are you using client hook for fetching the user data? I had the same problem before, so I use server action to fetch the use data and pass to the client components instead
with server action my TTFB increased and page load was way slow
soo i shited to client side fetching with axios and react query
@American Sable are you using client hook for fetching the user data? I had the same problem before, so I use server action to fetch the use data and pass to the client components instead
my api route is giving me correct data but my page somehow shows previous user data
using fetch cache:"no-store" in fetch
i removed axios
alos using export const dynamic = "force-dynamic" on my route