#on-demand servercomponents instead of pre-rendered

3 messages · Page 1 of 1 (latest)

cerulean solstice
#

Can a server component that has been passed as a prop to a client component
do SSR per request? It seems that I'm only doing build time render or caching data.

the server component gets data from redis
the page shows updated data only after redeploy so I suspect I'm only pre-rendering

How to get server component to render again per request?
basically looking to do appdir version of getServerSideProps

I see that in the docs they want you to use
fetch and disable caching, is this the only way?
I cannot just do

const data = await db.get('example')

?

I do NOT want this data to be cached hard. Just generate the server html on each request. I saw I could do fetch that then does this operation and set no-cache to the fetch

(using next@latest, appdir, deploy to vercel)

tender gateBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

cerulean solstice
#

ok, found what I needed. Just needed to convert this one
page to force dynamic in page.tsx

actually the docs of next are super good but just full of stuff for a noob like me.

export const dynamic = 'force-dynamic'