#revalidatePath("/") not working

30 messages · Page 1 of 1 (latest)

green vectorBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

languid heron
#

Revalidate doesn't run the code untill there is a request for it (just deletes cache)

narrow canopy
#

I am having this issue as well and its a major blocker for our client deployment

languid heron
#

Define "not working". Does it load the updated page on next access of hompage?

narrow canopy
#

Revalidation is not working in next.js v13.

I am using /pages and setting revalidation: 10 in my staticProps. I have used revalidation successfully on next 12.

When I make an update in my CMS (Contentful). If I browse to my homepage through the url, after 10 secs the revalidation works.

However when I click the top left logo which uses <Link href={"/"}> it always uses the cached page and it never updates. Leading my client to think the content they updated has reset. This happens on all links. If I go to the page through browser url the revalidation works. I have tried in 13.3.0, 13.4.19, 13.5.3 and other versions. Desperate to find a solution for this. At this point I am almost positive this is broken in next.js.

narrow canopy
#

@languid heron

languid heron
#

It is also app dir only iirc

narrow canopy
#

you mean revalidation?

#

Ive used it in version 12 and its still supposed to work in 13 with pages directory

languid heron
#

I'm talking about the revalidate path function, in your page it does revalidate, but not the same way

#

Also is there client cache for your pages when using next/link?

narrow canopy
#

It does seem to be related to next/link

#

next/link uses stale cache content always

#

but refreshing the page or entering through browser url always gets the revalidated content

languid heron
#

Disable prefetch or use router.reload (idk it pages router does same thing tho)

narrow canopy
#

So use reload on every link?

#

feels very hacky but not a bad idea

languid heron
#

Well refresh if your client modificatied something

#

And disable prefetch to make it harder to get stale data

#

Other wise you can use basic a link or refresh after (not the best tho)

narrow canopy
#

need some validation (pun) from next.js this is an actual issue or if there is an actual workaround.

languid heron
#

(this question is common, but no real way that I know of doing the nice change but have new data)

narrow canopy
#

have spent a lot of extra time troubleshooting something that seems to be an issue in next.js

languid heron
#

I wouldn't call it an issue, just something that the team doesn't think needs to be implemented (I wish there was a disable cache method)

#

Or at least swr like using cached data but then get new data (you can kinda with .refresh but if it isn't cached, that's 2 reqursts)

meager surge
languid heron
#

I mean when you revalidate homepage, you have t reload the page to see the query

meager surge
#

i understood the problem now , but still can't find a fix , NewPost is the component that adds the new post, but the PostQuoteSelector is the component that shows them , i could use router.refresh() but it would relead only the component from which is called(NewPost), how can i refresh PostQuoteSelector after addig a new post in NewPost? (both are client components)

languid heron
#

router.refesh reloads the whole page effectivly