Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nuxt): set config on ssrContext in spa renderer #20216

Merged
merged 2 commits into from Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/nuxt/src/core/runtime/nitro/renderer.ts
Expand Up @@ -124,13 +124,13 @@ const getSPARenderer = lazyCachedFunction(async () => {
ssrContext!.payload = {
_errors: {},
serverRendered: false,
config: {
public: config.public,
app: config.app
},
data: {},
state: {}
}
ssrContext.config = {
public: config.public,
app: config.app
}
ssrContext!.renderMeta = ssrContext!.renderMeta ?? getStaticRenderedHead
return Promise.resolve(result)
}
Expand Down
1 change: 1 addition & 0 deletions test/basic.test.ts
Expand Up @@ -46,6 +46,7 @@ describe('route rules', () => {
const { script, attrs } = parseData(await $fetch('/route-rules/spa'))
expect(script.serverRendered).toEqual(false)
expect(attrs['data-ssr']).toEqual('false')
await expectNoClientErrors('/route-rules/spa')
})

it('test noScript routeRules', async () => {
Expand Down
@@ -1,5 +1,5 @@
export default defineNuxtPlugin((nuxtApp) => {
if (nuxtApp.payload.blinkable !== '<revivified-blink>') {
if (nuxtApp.payload.serverRendered && nuxtApp.payload.blinkable !== '<revivified-blink>') {
throw createError({
message: 'Custom type in Nuxt payload was not revived correctly'
})
Expand Down