Replies: 6 comments 21 replies
-
Same problem, seached everything and couldn't find a fix. I wonder why no one is talking about this. Revalidation is not working |
Beta Was this translation helpful? Give feedback.
-
Same issue link: #51788 |
Beta Was this translation helpful? Give feedback.
-
Can we get a response from code owners please? This is a serious problem. There is currently no way for a page/route to guarantee fresh data on navigation. |
Beta Was this translation helpful? Give feedback.
-
I have some issue an I can't use server action - I use client side form library |
Beta Was this translation helpful? Give feedback.
-
Someday this issue will be addressed. Just posting this to keep the tread alive. |
Beta Was this translation helpful? Give feedback.
-
any fix? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
UPDATE: See the demo repo here: https://github.com/naishe/stale-data You can emulate the issue in
dev
mode. However, I am seeing EXACT same issue on my application in dev as well as prod (Vercel) deployments. To simplify, I haven't used auth or databases just a JSON file.Visual user? See this clip I created. The top window shows the what the end user sees, and the the bottom shows the changes in
json
file which works as the database. You can see they are out of sync most of the times.Screen.Recording.2023-06-22.at.4.22.40.PM.mov
The Setup
I have a page that displays user details (name, phone number etc) say,
/user/details/[id]
. It has an edit buton, that takes you to another page,/user/edit/[id]
, that has a form client component.Data retrieval
In
/user/details/[id]
, I just pull the data from the database and render a card with the values and give a<Link ...
to/user/edit/${userId}
. On this page, I pull the user data again from the db, and pass it off to the form which is a client component.The issue
The user goes to the details page sees the data in the database. Good. :)
The user clicks edit, the form gets populated with right data. OK.
The user changes values, and the form gets submitted to
/api/users/update
usingfetch
, data gets saved, client gets 200.On receiving 200, I redirect the user to
/user/details/${userId}
usingrouter.push
fromnext/navigation
package (Notice this is client component, I cannot use router fromnext/router
).I see STALE DATA on the details page.
I click edit button, form loads, and
I see STALE DATA in the form.
I definitely not want to
const revalidate = 0;
orconst revalidate = 1;
on those pages, because most of the time they wouldn't want to edit the data. BUT, for experimentation, I set these values on both the pages. I wasn't sure if 0 means never validate, so I tested with 0 and 1 both, waited long enough in before clicking save to ensure the cache is expired (apparently not expired). I deployed the code on Vercel production mode. Still, I see stale data.What am I doing wrong?
Thanks for reading. I am open to any ideas at this moment.
Additional information
Beta Was this translation helpful? Give feedback.
All reactions