Next.js Discord

Discord Forum

Force-Dynamic still cached?

Unanswered
Chartreux posted this in #help-forum
Open in Discord
ChartreuxOP
I have a page.tsx with export const dynamic = "force-dynamic". I load data with Prisma in there, output a headline with the amount of results and pass the data to a component that shows a table. When I'm in prod and add entries to the DB, the count increases, but the table does not update. How is it possible that there's still something cached? I switched to dynamic because the export const revalidate = 300; had the same problem, but not even dynamic helped to fix it. When I redeploy, it gets updated tho.

6 Replies

ChartreuxOP
I'm so confused. I have the same problem locally, but as soon as I change code in the table component it updates. So I run in dev mode, add an entry, headline says "2 entries", table component shows one, I add a console.log to the table component => page shows both entries. how on earth πŸ˜„
Are you deploying to vercel
ChartreuxOP
No I'm hosting on an own coolify instance
It might be some of its cache settings maybe, when you run the app locally (after building the app), do you get the same issue
ChartreuxOP
Holy shit, I found it. I moved parts of my Prisma queries out of the function itself because I was reusing them in different queries and then I just used them as where { ...newPosts } for example. Guess who had a lte: new Date(); in there, that was generated on launch of the next app and then never again. Hell that was confusing πŸ˜„
These 3 hour debugging sessions where you could swear the bug makes no sense at all and is impossible πŸ˜„