Next.js Discord

Discord Forum

How to prevent thousands of requests?

Unanswered
Japanese Bobtail posted this in #help-forum
Open in Discord
Japanese BobtailOP
Hi there. I'am using nextjs 14.1. and i wondering about the "click delay" in my app (sometimes 1-2 seconds after the click). Found the problem in "generateMetadata". If i use it with my fetch function (no-store), Chrome is starting thousands of request until the page is visible. If i disable the "generateMetadata", the clicks are "instant" and the multiple requests are gone even with "no-store" (later i will use revalidate). Whats wrong with my code? Thanks for help.

import { notFound } from 'next/navigation';
import { getPage } from '@/src/lib/FetchData';

export async function generateMetadata({ params }) {
const page = await getPage(params.slug);
if (!page) return notFound();

return {
title: page?.title.replace('&', '&') '',
description: page?.excerpt
'',
};
}

export default async function Page({ params }) {
const page = await getPage(params.slug);
if (!page) return notFound();

const { title, text } = page;

return
#Unknown Channel
<div>{title}</div>
<div>{text}</div>
</>

}

1 Reply

Original message was deleted
Japanese BobtailOP
Requests