Website API changes only show on redeployment
Unanswered
Briquet Griffon Vendéen posted this in #help-forum
Briquet Griffon VendéenOP
I created my first dashboard for an ecommerce site and it seems to be working very well. With minor bugs, patching, posting, deletion and getting works well. When working in development on localhost, all api changes, are shown immediately. Once I deployed my dashboard, creating, deleting, etc. all work as it shows in the database, however the deployed website doesn't show these changes like the localhost. Only after I redeploy do they show. How do I fix this?
4 Replies
@Briquet Griffon Vendéen I created my first dashboard for an ecommerce site and it seems to be working very well. With minor bugs, patching, posting, deletion and getting works well. When working in development on localhost, all api changes, are shown immediately. Once I deployed my dashboard, creating, deleting, etc. all work as it shows in the database, however the deployed website doesn't show these changes like the localhost. Only after I redeploy do they show. How do I fix this?
add
export const dynamic = 'force-dynamic' to the dashboard page file@joulev add `export const dynamic = 'force-dynamic'` to the dashboard page file
Briquet Griffon VendéenOP
My dashboard doesn't necessarily have a page. My routes look like
@Briquet Griffon Vendéen My dashboard doesn't necessarily have a page. My routes look like
so add
what you saw here is the static-by-default behaviour of the app router; everything is cached by default, you need to opt out by using dynamic functions (
export const dynamic = 'force-dynamic' to whichever that is being cachedwhat you saw here is the static-by-default behaviour of the app router; everything is cached by default, you need to opt out by using dynamic functions (
headers() for example) or explicitly forcing force-dynamic, see https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic-renderingBriquet Griffon VendéenOP
ty ty fixed everything