Data not updating
Unanswered
Band-rumped Storm-Petrel posted this in #help-forum
Band-rumped Storm-PetrelOP
Hi All.
Im experiencing some weird behaviour. I have a fetch my data from my database directtly.
Locally if I update the data in my database and refresh the page, it gets the latest data.
However when I've deployed my site to netlify or vercel it does not get the latest data, unless I do a fresh build after a data change. I know I can use
Another thing I find weird is that when I use supbases ssr package to fetch the data I dont get this behaviour on vercel or netlify. Is this a prisma issue?
Here is my page below (i'm using app router):
Thanks
Im experiencing some weird behaviour. I have a fetch my data from my database directtly.
Locally if I update the data in my database and refresh the page, it gets the latest data.
However when I've deployed my site to netlify or vercel it does not get the latest data, unless I do a fresh build after a data change. I know I can use
export const dynamic = 'force-dynamic'
but i was hoping someone can explain the behvaiour to me and explain why its hapening only on the deployed environment. Another thing I find weird is that when I use supbases ssr package to fetch the data I dont get this behaviour on vercel or netlify. Is this a prisma issue?
Here is my page below (i'm using app router):
import { prisma } from "./utils/db";
export default async function Home() {
const posts = await prisma.post.findMany();
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<main className="flex flex-col gap-8 row-start-2 items-center sm:items-start">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
{posts.map((post) => (
<div key={post.id} className="flex flex-col gap-4">
<h2 className="text-xl font-bold">{post.title}</h2>
<p>{post.content}</p>
</div>
))}
</div>
</main>
</div>
);
}
Thanks