Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

feugy
Copy link
Member

@feugy feugy commented Dec 8, 2023

📓 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.

@feugy feugy requested review from tobiaslins and a team December 8, 2023 13:41
Copy link

vercel bot commented Dec 8, 2023

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

@feugy feugy force-pushed the damien/aly-1110-sveltekit-canno-read-properties-of-undefined branch from 7b9a2bf to 5954ca5 Compare December 8, 2023 13:42
@feugy feugy force-pushed the damien/aly-1110-sveltekit-canno-read-properties-of-undefined branch from 5954ca5 to 44c82bf Compare December 8, 2023 13:44
@feugy feugy force-pushed the damien/aly-1110-sveltekit-canno-read-properties-of-undefined branch from 44c82bf to 2889995 Compare December 8, 2023 13:56
@feugy feugy merged commit a39b547 into main Dec 8, 2023
8 checks passed
@feugy feugy deleted the damien/aly-1110-sveltekit-canno-read-properties-of-undefined branch December 8, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants