useSearchParams() should be wrapped in a suspense boundary at page but no search params used?
Answered
Cornish Rex posted this in #help-forum
Cornish RexOP
Hey guys i do use search params in other pages but im getting the error at /gallery which is a very basic file:
but why am i getting the suspense error?
import prisma from "@/lib/db";
import Image from "next/image";
import React from "react";
const page = async () => {
const images = await prisma.gallery.findMany();
return (
<div className="container mx-auto px-4 py-4">
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3">
{images.map(({ id, path }) => (
<Image
key={id}
width={330}
height={330}
className="object-cover object-center w-full h-[330px] max-w-full rounded-lg"
src={`/imgs/gallery/${path}`}
alt="gallery"
/>
))}
</div>
</div>
);
};
export default page;
but why am i getting the suspense error?
sr-bailout
Error occurred prerendering page "/gallery". Read more: https://nextjs.org/docs/messages/prerender-error
Export encountered an error on /(public)/gallery/page: /gallery, exiting the build.
⨯ Static worker exited with code: 1 and signal: null
Answered by Cornish Rex
build cache was causing the issue, fixed after deleting .next folder
1 Reply
Cornish RexOP
build cache was causing the issue, fixed after deleting .next folder
Answer