#How do you get a server-rendered page to rerender (next13 app dir)?

14 messages · Page 1 of 1 (latest)

formal steppe
#

If you imagine a really simple server component page that awaits some function that returns data from the DB, how do I ensure the data is fresh? e.g., user account page, user makes edit, leaves, comes back, sees stale original data.

I think I want the concept of "pre-rendered", but I'm finding that client-side state is clobbered every time this server rendered page is re-mounted

sterile ibex
#

In a few months the app directory will have built in support for mutation, then it will be much simpler

formal steppe
formal steppe
#

this makes it awkard if another page alters the underlying data (because refresh doesn't look to take a URL argument), but it sounds like if I have a client-component inside my server component, I just need a useEffect(() => router.refresh(), [])

#

beautiful tyvm @sterile ibex, I think this is what I was looking for last night but was too poor at phrasing

sterile ibex
#

Although improvement is coming, we have some teasers on twitter as well

formal steppe
#

@ what handle?

#

is NextRequest available to the server component at all? I'd like to reuse helpers I made for my API but they're all req based

sterile ibex