mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): set config on ssrContext
in spa renderer (#20216)
This commit is contained in:
parent
8f67d871b8
commit
fe2800540c
@ -124,13 +124,13 @@ const getSPARenderer = lazyCachedFunction(async () => {
|
|||||||
ssrContext!.payload = {
|
ssrContext!.payload = {
|
||||||
_errors: {},
|
_errors: {},
|
||||||
serverRendered: false,
|
serverRendered: false,
|
||||||
config: {
|
|
||||||
public: config.public,
|
|
||||||
app: config.app
|
|
||||||
},
|
|
||||||
data: {},
|
data: {},
|
||||||
state: {}
|
state: {}
|
||||||
}
|
}
|
||||||
|
ssrContext.config = {
|
||||||
|
public: config.public,
|
||||||
|
app: config.app
|
||||||
|
}
|
||||||
ssrContext!.renderMeta = ssrContext!.renderMeta ?? getStaticRenderedHead
|
ssrContext!.renderMeta = ssrContext!.renderMeta ?? getStaticRenderedHead
|
||||||
return Promise.resolve(result)
|
return Promise.resolve(result)
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ describe('route rules', () => {
|
|||||||
const { script, attrs } = parseData(await $fetch('/route-rules/spa'))
|
const { script, attrs } = parseData(await $fetch('/route-rules/spa'))
|
||||||
expect(script.serverRendered).toEqual(false)
|
expect(script.serverRendered).toEqual(false)
|
||||||
expect(attrs['data-ssr']).toEqual('false')
|
expect(attrs['data-ssr']).toEqual('false')
|
||||||
|
await expectNoClientErrors('/route-rules/spa')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('test noScript routeRules', async () => {
|
it('test noScript routeRules', async () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export default defineNuxtPlugin((nuxtApp) => {
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
if (nuxtApp.payload.blinkable !== '<revivified-blink>') {
|
if (nuxtApp.payload.serverRendered && nuxtApp.payload.blinkable !== '<revivified-blink>') {
|
||||||
throw createError({
|
throw createError({
|
||||||
message: 'Custom type in Nuxt payload was not revived correctly'
|
message: 'Custom type in Nuxt payload was not revived correctly'
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user