Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 10 Parital Prerendering, dynamic vs static, potential incorrect statement #881

Open
a89529294 opened this issue Oct 8, 2024 · 1 comment

Comments

@a89529294
Copy link

link
In the section Static vs. Dynamic Routes, it is said that "if you call a dynamic function in a route (like querying your database), the entire route becomes dynamic." But this is not true, I ran npm run build and noticed that the dashboard page is still statically rendered. I also ran npm run start and noticed that the 3 seconds delay for fetchRevenue did not happen, indicating that the dashboard page is static.
Even when i embed a direct db call in dashboard/page.tsx, the page remains static.

@simonc56
Copy link

simonc56 commented Oct 17, 2024

I managed to have dynamic data in dashboard by using unstable_noStore in data.ts so that Next will not cache db data and re-fetch it at each client request.

import { unstable_noStore as noStore } from 'next/cache';
// ...

export async function fetchRevenue() {
  noStore();
  // ...

Strange it was removed in this PR :

  • Remove the noStore() calls. With the changes in Next.js 15, these queries are not cached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants