vercel / speed-insights

Vercel Speed Insights package
https://vercel.com/docs/speed-insights
Apache License 2.0
57 stars 9 forks source link

fix(#27): sveltekit route is not always defined #30

Closed feugy closed 10 months ago

feugy commented 10 months ago

๐Ÿ““ What's in there?

In a Sveltekit application, when importing injectSpeedInsight() into a +layout.js/ts file, the route could be undefined.

๐Ÿงช How to test?

On the preview deployment, we can navigate between the 2 pages and see the metrics being collecting, and assigned to the correct route.

image

โ— Notes to reviewers

Please focus on +layout.js file. I brought a simpler skeleton app instead of the full demo app which is irrelevant for us.

This must be an edge case, because this injectSpeedInsight() contains conditionals to only run on the client side, where the route should always be available. We can see the metrics correctly applied to the current route.

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Comments Updated (UTC)
speed-insights-nextjs โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Dec 8, 2023 2:09pm
speed-insights-nuxt โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Dec 8, 2023 2:09pm
speed-insights-remix โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Dec 8, 2023 2:09pm
speed-insights-sveltekit โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Dec 8, 2023 2:09pm
speed-insights-vue โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Dec 8, 2023 2:09pm