From d874726ffb7911c99dff1253efff72c172dfeb37 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 9 Dec 2024 15:19:10 +0000 Subject: [PATCH 1/2] fix(nuxt): guard `window` access --- packages/nuxt/src/pages/runtime/validate.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/pages/runtime/validate.ts b/packages/nuxt/src/pages/runtime/validate.ts index 263eab3cdc..ef8998dbe7 100644 --- a/packages/nuxt/src/pages/runtime/validate.ts +++ b/packages/nuxt/src/pages/runtime/validate.ts @@ -29,7 +29,9 @@ export default defineNuxtRouteMiddleware(async (to) => { // We pretend to have navigated to the invalid route so // that the user can return to the previous page with // the back button. - window?.history.pushState({}, '', to.fullPath) + if (typeof window !== 'undefined') { + window.history.pushState({}, '', to.fullPath) + } }) // We stop the navigation immediately before it resolves // if there is no other route matching it. From 4d13f1027a9de4024a7758185a39fca6a6347cc9 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 9 Dec 2024 16:20:55 +0000 Subject: [PATCH 2/2] docs: fix link to issue --- packages/schema/src/config/experimental.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schema/src/config/experimental.ts b/packages/schema/src/config/experimental.ts index 35d340e2c4..9479ffd402 100644 --- a/packages/schema/src/config/experimental.ts +++ b/packages/schema/src/config/experimental.ts @@ -420,7 +420,7 @@ export default defineUntypedSchema({ /** * Keep showing the spa-loading-template until suspense:resolve - * @see [Nuxt Issues #24770](https://github.com/nuxt/nuxt/issues/21721) + * @see [Nuxt Issues #21721](https://github.com/nuxt/nuxt/issues/21721) * @type {'body' | 'within'} */ spaLoadingTemplateLocation: {