Next.js Discord

Discord Forum

content update issue

Unanswered
Mini Satin posted this in #help-forum
Open in Discord
Mini SatinOP
I am pulling the data through prisma. When I make a change on the database after receiving the build, I cannot see the changes. What is the reason for this? I tried 'export const revalidate = 10' but it did not work.

7 Replies

you can do ```tsx```
and then paste your code to make it look better
conosle.log("like this");
Mini SatinOP
export async function generateStaticParams() {
  const post = await db.post.findMany()
  return post.map(game => ({postId: post.id}))
}

const PostId= async ({ params }: PostIdProps) => {
  try {
    const post = await db.post.findUnique({
      where: {
        id: params.postId,
      },
      include: {
        category: true,
      },
    });

    if (!post) {
      return (
        <NotFound />
      );
    }

    const category: string[] = game.category.map((ctgr) => ctgr.id) ?? [];

    const posts = await db.category.findUnique({
      where: {
        id: category[0],
      },
      include: {
        posts: true,
      },
    });

    const categoryPosts = posts?.posts.map((gms) => gms) ?? [];

    const categories = (await db.category.findMany()).slice(0, 16);

    return (
      <div>
          <Post
            id={post?.id!}
            imageUrl={post?.imageUrl!}
            name={post?.name!}
          />
I don't understand the logic of "On-demand Revalidation". I pull the data from the database with prisma. How should I proceed?
Mini SatinOP
I solved this problem with ' export const dynamic = "force-dynamic" ', but this time I get an error when exporting.
"Export encountered errors on following paths:" Please help me