Skip to content

Conversation

@ThibaudDauce
Copy link
Contributor

Nuxt's useFetch options lazy and server are orthogonal: lazy controls whether the fetch blocks rendering/navigation, while server controls whether the fetch runs on the server at all. There is no combination of these options that achieves "block during SSR but don't block during client-side navigation" (nuxt/nuxt#19326). Setting lazy: true makes navigation instant but also skips server-side data fetching, which hurts SEO. Setting server: true, lazy: false (the default) preserves SSR but blocks client-side navigation until the API responds. Using lazy: import.meta.client leverages Vite's compile-time constants to get the best of both worlds: the server bundle gets lazy: false (data is fetched during SSR), while the client bundle gets lazy: true (instant navigation with a loading state).

@nicolaskempf57
Copy link
Contributor

I don't understand the issue, lazy :true is the solution to wait for the request on SSR and not on client site navigation. This is what we do for most of the admin requests

@ThibaudDauce
Copy link
Contributor Author

I don't understand the issue, lazy :true is the solution to wait for the request on SSR and not on client site navigation. This is what we do for most of the admin requests

I simplified in dc27824. I think I misunderstood the issue in nuxt/nuxt#19326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants