You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$fetch function calling capabilities in SSR is cool, but when I prerender an expensive route via routeRules I don't want the useFetch composable / $fetch calls to re-run the computation, I want to return the prerendered response.
Additional information
Would you be willing to help implement this feature?
While perendering, useFetch/useAsyncData has to run to ensure that the correct content is fetched (unless set to server: false, but then it is not part of the server-rendered content).
Let's say you have /api/fetchSomething.ts that takes 10 whole seconds to fetch that data.
You then move to routeRules and you set { '/api/fetchSomething': { prerender: true }
At that point, that API gets prerendered and transformed as a plain text file during your build, but:
If you fetch that route externally or during CSR: instant response with the prerendered content ensues (yay! 🎉 )
If you have a useFetch inside a component setup, and that component/page gets SSR, the expensive computation gets called (so the page takes 10+ seconds to render
That's a helpful explanation. Our 'internal' fetch should fetch from public assets rather than via the handler in this case. (We should probably also strip the handler from the server bundle to improve performance.)
Describe the feature
$fetch function calling capabilities in SSR is cool, but when I prerender an expensive route via routeRules I don't want the useFetch composable / $fetch calls to re-run the computation, I want to return the prerendered response.
Additional information
Final checks
The text was updated successfully, but these errors were encountered: