diff --git a/packages/nitro/src/runtime/app/render.ts b/packages/nitro/src/runtime/app/render.ts index 0742e5d346..b32342284d 100644 --- a/packages/nitro/src/runtime/app/render.ts +++ b/packages/nitro/src/runtime/app/render.ts @@ -27,7 +27,10 @@ const getSSRRenderer = cachedResult(async () => { const getSPARenderer = cachedResult(async () => { const clientManifest = await getClientManifest() return (ssrContext) => { - ssrContext.nuxt = {} + ssrContext.nuxt = { + serverRendered: false, + config: publicConfig + } return { html: '
', renderResourceHints: () => '', diff --git a/packages/nuxt3/src/app/composables/asyncData.ts b/packages/nuxt3/src/app/composables/asyncData.ts index d36dbdf790..ff670dfdce 100644 --- a/packages/nuxt3/src/app/composables/asyncData.ts +++ b/packages/nuxt3/src/app/composables/asyncData.ts @@ -104,8 +104,8 @@ export function useAsyncData< return nuxt._asyncDataPromises[key] } - const fetchOnServer = options.server !== false - const clientOnly = options.server === false + const fetchOnServer = options.server !== false && nuxt.payload.serverRendered + const clientOnly = options.server === false || !nuxt.payload.serverRendered // Server side if (process.server && fetchOnServer) {