Fetching data on server side in generate mode #1160
Unanswered
anatolykopyl
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I can't figure out a way to fetch data during static site generation and have it persist to the client side.
The fetching is happening inside of a composable that wraps
useFetch
and is widely used across the app.Here's the ways I tried to migrate this composable:
useLazyAsyncData
This seemed like the most straight forward way of doing things, but the client first sees the page without the fetched data.
useLazyAsyncData
+onServerPrefetch
Then I tried to call the
refresh
function fromuseLazyAsyncData
inonServerPrefetch
. Still no initial data on client.useState
An alternative way I tried is to have a
useState
ref and fetch data manually inonServerPrefetch
. Still nothing.This is something I've been fighting with for a pretty long time now, so any advice would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions