From 5d99c64f6f16376c75f876e9c037862338943d3c Mon Sep 17 00:00:00 2001 From: s1gr1d <32902192+s1gr1d@users.noreply.github.com> Date: Thu, 9 Apr 2026 14:27:27 +0200 Subject: [PATCH] feat(nuxt): Exclude tracing meta tags on cached pages in Nuxt 5 --- .../nuxt-5/tests/tracing.cached-html.test.ts | 6 ++---- packages/nuxt/src/runtime/plugins/sentry.server.ts | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.cached-html.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.cached-html.test.ts index 7c7d51af4d4f..3a6614f5cb4d 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.cached-html.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.cached-html.test.ts @@ -14,13 +14,11 @@ test.describe('Rendering Modes with Cached HTML', () => { await testChangingTracingMetaTagsOnISRPage(page, '/rendering-modes/isr-1h-cached-page', 'ISR 1h Cached Page'); }); - // TODO: Make test work with Nuxt 5 - test.skip('exclude tracing meta tags on SWR-cached page', async ({ page }) => { + test('exclude tracing meta tags on SWR-cached page', async ({ page }) => { await testExcludeTracingMetaTagsOnCachedPage(page, '/rendering-modes/swr-cached-page', 'SWR Cached Page'); }); - // TODO: Make test work with Nuxt 5 - test.skip('exclude tracing meta tags on SWR 1h cached page', async ({ page }) => { + test('exclude tracing meta tags on SWR 1h cached page', async ({ page }) => { await testExcludeTracingMetaTagsOnCachedPage(page, '/rendering-modes/swr-1h-cached-page', 'SWR 1h Cached Page'); }); diff --git a/packages/nuxt/src/runtime/plugins/sentry.server.ts b/packages/nuxt/src/runtime/plugins/sentry.server.ts index 63b4f6c107be..516dda7d8781 100644 --- a/packages/nuxt/src/runtime/plugins/sentry.server.ts +++ b/packages/nuxt/src/runtime/plugins/sentry.server.ts @@ -21,7 +21,9 @@ export default (nitroApp => { !!(event as any).res?.headers?.has?.('x-nitro-prerender'); // oxlint-disable-next-line typescript-oxlint/no-unsafe-member-access - const isSWRCachedPage = event?.context?.cache?.options?.swr as boolean | undefined; + const isSWRCachedPage = /* Nitro v2 */ (event?.context?.cache?.options?.swr || + // oxlint-disable-next-line typescript-oxlint/no-unsafe-member-access + /* Nitro v3 */ event?.context?.routeRules?.swr) as boolean; if (!isPreRenderedPage && !isSWRCachedPage) { addSentryTracingMetaTags(html.head);