#Dynamic rendering do not refetch certain queries.

22 messages · Page 1 of 1 (latest)

severe raptor
#

Hi my app is dynamically rendered because of checking cookies for user authentication in main layout (it makes all pages dynamic).

Some pages have data that I do not want to fetch on every request like cms content but I want to fetch dynamically other data that this page uses.

// page.tsx
// dynamic rendered page
export async function Page(){
  // fetch it once during build and revalidate on demand or every 1h or so
  const cmsData = await getCmsData()

  const users = await getUsers() // fetch it dynamically and do not cache

How can I achive it?

rapid shuttleBOT
#

🔎 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)

quiet raptor
severe raptor
#

And when getCmsData doesnt use fetch

#

but graphql-request

#

or prisma directly?
@quiet raptor

severe raptor
#

So when someone goes to /home and fetches the cms data

Then when another person enters /home we have cms data in cache?

#

and its not fetched?

quiet raptor
#

yes

severe raptor
#

Sure

#

Thanks

severe raptor
#

@quiet raptor what about cache from react

#

I can't understand a difference

quiet raptor
severe raptor
#

From my understanding next stores data in server cache and react only stores IT client side

quiet raptor
#

when the request is finished, the data is gone

severe raptor
#

Aight

severe raptor
#

Thanks!