Next.js Discord

Discord Forum

Duplicate request sent in official tutorial example

Unanswered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
Hi all, I'm following the official tutorial (https://nextjs.org/learn) on next.js. I'm using Next.js 14.0.2, node v18.19.0, npm 10.2.3. I also downloaded and tried the full example from Github(https://github.com/vercel/next-learn/tree/main/dashboard/final-example).
What I did is following:
1. add reactStrictMode: false in next.config.js to make sure React strict mode is off.
2. comment out the log statement console.log('Fetching revenue data...'); and console.log('Data fetch completed after 3 seconds.'); in the data.ts file, fetchRevenue method.
3. add the log console.log('rendering revenue-chart'); in revenue-chart.tsx, console.log('render dashboard main page'); in @/app/dashboard/(overview)/page.tsx.
4. run the program and navigate to http://localhost:3000/dashboard.

In the console, you will see
render dashboard main page
rendering revenue-chart
Fetching revenue data...
Data fetch completed after 3 seconds.

printed twice, which means the DB is fetched twice. What's happening here? I think I already turned off the strict mode, so it may be something related to next.js itself.

0 Replies