Skip to content

Commit 0f52cb2

Browse files
committed
fix: return 400 error for initial payload
1 parent 75d3d8d commit 0f52cb2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

modules/isr-fallback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default defineNuxtModule({
3131
const outputPath = resolve(nitro.options.output.serverDir, '..', path, htmlFallback)
3232
mkdirSync(resolve(nitro.options.output.serverDir, '..', path), { recursive: true })
3333
writeFileSync(outputPath, spaTemplate)
34-
writeFileSync(outputPath.replace(htmlFallback, jsonFallback), 'null')
34+
writeFileSync(outputPath.replace(htmlFallback, jsonFallback), '{}')
3535
}
3636
})
3737
})

nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ function getISRConfig(expirationSeconds: number, options: ISRConfigOptions = {})
364364
fallback:
365365
options.fallback === 'html' ? 'spa.prerender-fallback.html' : 'payload-fallback.json',
366366
initialHeaders: options.fallback === 'json' ? { 'content-type': 'application/json' } : {},
367+
initialStatus: options.fallback === 'json' ? 400 : undefined,
367368
} as { expiration: number },
368369
}
369370
}

0 commit comments

Comments
 (0)