From 9dfc0c2c31bc8a756094e0eb693429ee8d6a8415 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 5 Feb 2024 11:57:49 +0000 Subject: [PATCH] fix(nuxt): don't check page/layout usage when redirecting (#25628) --- packages/nuxt/src/app/plugins/check-if-layout-used.ts | 2 +- packages/nuxt/src/pages/runtime/plugins/check-if-page-unused.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/app/plugins/check-if-layout-used.ts b/packages/nuxt/src/app/plugins/check-if-layout-used.ts index b8d80f20b4..9cf7192ea9 100644 --- a/packages/nuxt/src/app/plugins/check-if-layout-used.ts +++ b/packages/nuxt/src/app/plugins/check-if-layout-used.ts @@ -17,7 +17,7 @@ export default defineNuxtPlugin({ } } if (import.meta.server) { - nuxtApp.hook('app:rendered', () => { nextTick(checkIfLayoutUsed) }) + nuxtApp.hook('app:rendered', ({ renderResult }) => { renderResult?.html && nextTick(checkIfLayoutUsed) }) } else { onNuxtReady(checkIfLayoutUsed) } diff --git a/packages/nuxt/src/pages/runtime/plugins/check-if-page-unused.ts b/packages/nuxt/src/pages/runtime/plugins/check-if-page-unused.ts index 0532be5a59..a347ff11cb 100644 --- a/packages/nuxt/src/pages/runtime/plugins/check-if-page-unused.ts +++ b/packages/nuxt/src/pages/runtime/plugins/check-if-page-unused.ts @@ -19,7 +19,7 @@ export default defineNuxtPlugin({ } if (import.meta.server) { - nuxtApp.hook('app:rendered', () => { nextTick(checkIfPageUnused) }) + nuxtApp.hook('app:rendered', ({ renderResult }) => { renderResult?.html && nextTick(checkIfPageUnused) }) } else { onNuxtReady(checkIfPageUnused) }