revalidatepath not working in vercel
Answered
Tan posted this in #help-forum
Original message was deleted.
63 Replies
Original message was deleted
hi, what do you mean only upper one works?
@Ray hi, what do you mean only upper one works?
Tan
Hi thank you for replying :
revalidatePath("/admin/jobs"); this page is revalidated
revalidatePath("/careers"); but this page is not revalidated
revalidatePath("/admin/jobs"); this page is revalidated
revalidatePath("/careers"); but this page is not revalidated
@Ray can you show the code of careers?
Tan
import React from "react";
import AvailableVacencies from "./AvailableVacencies";
import Vacancy from "@/models/Vacancy";
import connectDB from "@/utils/connectDB";
export const revalidate = 10;
const page = async () => {
await connectDB();
const data = await Vacancy.find();
return (
<>
<AvailableVacencies data={data} />
</>
);
};
export default page;do you get updated data in a refresh?
In local it works as intended
But not in vercel
I guess not on build
Tan
This is on localhost
This is on vercel
@Tan This is on localhost
can you try
next build && next start on local?gimme 5 mins
@Ray can you try `next build` && `next start` on local?
Tan
It is getting new data as expected on both pages
And I am also getting this warning on the logs
there is a report after you run
next buildcan you show it?
Tan
sure
@Ray there is a report after you run `next build`
Tan
here you go
and the page get updated with
next start on local too?@Ray and the page get updated with `next start` on local too?
Tan
yes it gets updated
wait I will show you
what version of next are you using?
Tan
"next": "14.0.4",
Its i think 3 weeks old
hmm can you try deploying it to a new project on vercel?
I will do it
@Ray hmm can you try deploying it to a new project on vercel?
Tan
Its not working
ah
is your project on github and is shareable?
@Ray is your project on github and is shareable?
Tan
is on github but its private
May i get your id I will add you
gimme a sec
Original message was deleted
Tan
Done
ok let me check
@Ray ok let me check
Tan
the admin route is not protected yet so can be opened without logging in
ok
ok got it working
@Tan And I am also getting this warning on the logs
had to remove all of these error
Answer
Tan
Why did you wrapped that navbar and progressabr in suspense 🤔
Tan
And when should I use dynamic Imports
@Ray https://metalogic-final-3pb8cki4y-raylee.vercel.app/careers
you can try it here
Tan
seems it requires authenctication
@Tan And when should I use dynamic Imports
whenever you using browser api you can use it with ssr disable
or when something is not visible at first render, you also can use it with ssr enable
@Ray whenever you using browser api you can use it with ssr disable
Tan
doesn't it work with using "use client" ?
🤔
what do you mean?
@Ray what do you mean?
Tan
I used to think that when I use "use client" it runs all the code even the children of that component would be rendered by the browser and when I use browser api then it would work
@Tan I used to think that when I use "use client" it runs all the code even the children of that component would be rendered by the browser and when I use browser api then it would work
no client component will still be rendered on server
@Ray no client component will still be rendered on server
Tan
Could you provide me resources about this. I want to know more
And Thank you so much for helping me out â¤ï¸
@Ray try this link https://metalogic-final-two.vercel.app
np let me know when you want me to remove this
@Ray np let me know when you want me to remove this
Tan
Yep working as intended
could be removed
Thank you again â¤ï¸
ok np