fix(nuxt): ensure we add prerender hints to correct event (#23799)

This commit is contained in:
Daniel Roe 2023-10-19 23:44:45 +01:00 committed by GitHub
parent 5a6dfd8847
commit 8c9333a41c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -114,7 +114,7 @@ export default defineComponent({
if (import.meta.server && import.meta.prerender) { if (import.meta.server && import.meta.prerender) {
// Hint to Nitro to prerender the island component // Hint to Nitro to prerender the island component
appendResponseHeader(event, 'x-nitro-prerender', url) nuxtApp.runWithContext(() => prerenderRoutes(url))
} }
// TODO: Validate response // TODO: Validate response
// $fetch handles the app.baseURL in dev // $fetch handles the app.baseURL in dev
@ -127,7 +127,7 @@ export default defineComponent({
if (import.meta.server && import.meta.prerender) { if (import.meta.server && import.meta.prerender) {
const hints = r.headers.get('x-nitro-prerender') const hints = r.headers.get('x-nitro-prerender')
if (hints) { if (hints) {
prerenderRoutes(hints) appendResponseHeader(event, 'x-nitro-prerender', hints)
} }
} }
setPayload(key, result) setPayload(key, result)

View File

@ -12,10 +12,8 @@ export default defineUntypedSchema({
* Value should be either a string or array of strings pointing to source directories or config path relative to current config. * Value should be either a string or array of strings pointing to source directories or config path relative to current config.
* *
* You can use `github:`, `gh:` `gitlab:` or `bitbucket:`. * You can use `github:`, `gh:` `gitlab:` or `bitbucket:`.
*
* @see https://github.com/unjs/c12#extending-config-layer-from-remote-sources * @see https://github.com/unjs/c12#extending-config-layer-from-remote-sources
* @see https://github.com/unjs/giget * @see https://github.com/unjs/giget
*
* @type {(string|string|[string, typeof import('c12').SourceOptions?])[]} * @type {(string|string|[string, typeof import('c12').SourceOptions?])[]}
*/ */
extends: null, extends: null,