Next.js Discord

Discord Forum

generateMetadata in called twice in dev mode

Unanswered
Chartreux posted this in #help-forum
Open in Discord
ChartreuxOP
I have dynamic route like [...slug] in app router and within page.tsx and generateMetadata I need to call same API endpoint. In dev mode, function generateMetadata is called twice and Next fires two requests to API. When I build and run production mode of app, everything works as expected. Is that expected behavior? I tried disable react strict mode but it doesn't help. How can I test during developement, whether using cache() function is working as expected?

Thank You,

0 Replies