Skip to content

Commit

Permalink
fix(nuxt): set config on ssrContext in spa renderer (#20216)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Apr 11, 2023
1 parent 8f67d87 commit fe28005
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/nuxt/src/core/runtime/nitro/renderer.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fe28005

Please sign in to comment.