Next.js Discord

Discord Forum

Statically render in production but dynamically render in dev?

Answered
Narrow-barred Spanish mackerel posted this in #help-forum
Open in Discord
Narrow-barred Spanish mackerelOP
I'm building a site with a strapi backend that will not change very much so in production i want to statically render everything, but i want to dynamically render while developing to make things faster.

right now i'm just putting in and taking out noStore()s manually which is not that great 😓 . Is there a good way to do this?

8 Replies

@joulev dev mode is always dynamically rendered, you need not do anything
Narrow-barred Spanish mackerelOP
maybe I'm confusing concepts then? If I start the dev server and then make changes to my database it doesn't show up when i refresh the page until I restart the server, unless I add noStore() to all my fetch functions.

from this: https://nextjs.org/learn/dashboard-app/static-and-dynamic-rendering
i thought that was because of static rendering.
@joulev make a reproduction repository
Narrow-barred Spanish mackerelOP
https://github.com/noah-evans/nextjs-dev-server-not-updating

this fetches the current time and displays it, but it won't update when you refresh unless you uncomment noStore() in app/data.js
Answer
hard refresh to clear the data cache