generateStaticParams with data being fetched in the component
Unanswered
West African Crocodile posted this in #help-forum
West African CrocodileOP
Do I misunderstand something about
My expectation would have been that every dynamic route is static now. Meaning: the result of getTicket is already there. But still I see a loading spinner for each page I visit.
generateStaticParams? I have the following code:type TicketPageProps = {
params: {
ticketId: string;
};
};
const TicketPage = async ({ params }: TicketPageProps) => {
const ticket = await getTicket(params.ticketId);
return <div>{ticket.name}</div>;
};
export default TicketPage;
export async function generateStaticParams() {
const tickets = await prisma.ticket.findMany();
return tickets.map((ticket) => ({
ticketId: ticket.id,
}));
}My expectation would have been that every dynamic route is static now. Meaning: the result of getTicket is already there. But still I see a loading spinner for each page I visit.
1 Reply
West African CrocodileOP
Not speaking about dev, but production build here.