mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nitro): inject payload for spa renderer (#1434)
This commit is contained in:
parent
ad7e7551ec
commit
c6f769e94d
@ -27,7 +27,10 @@ const getSSRRenderer = cachedResult(async () => {
|
|||||||
const getSPARenderer = cachedResult(async () => {
|
const getSPARenderer = cachedResult(async () => {
|
||||||
const clientManifest = await getClientManifest()
|
const clientManifest = await getClientManifest()
|
||||||
return (ssrContext) => {
|
return (ssrContext) => {
|
||||||
ssrContext.nuxt = {}
|
ssrContext.nuxt = {
|
||||||
|
serverRendered: false,
|
||||||
|
config: publicConfig
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
html: '<div id="__nuxt"></div>',
|
html: '<div id="__nuxt"></div>',
|
||||||
renderResourceHints: () => '',
|
renderResourceHints: () => '',
|
||||||
|
@ -104,8 +104,8 @@ export function useAsyncData<
|
|||||||
return nuxt._asyncDataPromises[key]
|
return nuxt._asyncDataPromises[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchOnServer = options.server !== false
|
const fetchOnServer = options.server !== false && nuxt.payload.serverRendered
|
||||||
const clientOnly = options.server === false
|
const clientOnly = options.server === false || !nuxt.payload.serverRendered
|
||||||
|
|
||||||
// Server side
|
// Server side
|
||||||
if (process.server && fetchOnServer) {
|
if (process.server && fetchOnServer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user