-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nuxt): Detect pageload by adding flag in Vue router (#13171)
Nuxt is using the Vue router under the hood, but the previous condition to detect a page load (`from.name == null && from.matched.length === 0`) does not work with Nuxt, as `from.matched` is never empty.
- Loading branch information
Showing
5 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
dev-packages/e2e-tests/test-applications/nuxt-3/tests/performance.client.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { expect, test } from '@nuxt/test-utils/playwright'; | ||
import { waitForTransaction } from '@sentry-internal/test-utils'; | ||
|
||
test('sends a pageload root span with a parameterized URL', async ({ page }) => { | ||
const transactionPromise = waitForTransaction('nuxt-3', async transactionEvent => { | ||
return transactionEvent.transaction === '/test-param/:param()'; | ||
}); | ||
|
||
await page.goto(`/test-param/1234`); | ||
|
||
const rootSpan = await transactionPromise; | ||
|
||
expect(rootSpan).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
data: { | ||
'sentry.source': 'route', | ||
'sentry.origin': 'auto.pageload.vue', | ||
'sentry.op': 'pageload', | ||
'params.param': '1234', | ||
}, | ||
op: 'pageload', | ||
origin: 'auto.pageload.vue', | ||
}, | ||
}, | ||
transaction: '/test-param/:param()', | ||
transaction_info: { | ||
source: 'route', | ||
}, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters