vercel / speed-insights

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

Regression: Speed Insights not differentiating between paths due to Parallel Route catchAll. #67

Closed steve-marmalade closed 6 months ago

steve-marmalade commented 6 months ago

Hi team, I think a somewhat recent change to NextJS has lead to a regression in Speed Insights.

Core problem: my dashboard shows primary a single path being hit /...catchAll, even though I'm certain that other paths are being navigated to.

image

The relevant part of my file structure is as follows:

app/@modal/[...catchAll]`
app/m/[merchantHandle]/p/[productSlug]

Taking a quick pass at the NextJS repo, my guess is that this regression was caused by one of the following PRs (probably 65063 from the magician @ztanner): https://github.com/vercel/next.js/pull/65063 https://github.com/vercel/next.js/pull/65233 https://github.com/vercel/next.js/pull/65277

Concretely, when I log the output of useParams and usePathname from a Client component in my root layout I see the following:

{"params":{"catchAll":["m","rowingblazers","p","the-croquet-stripe-rugby"],"merchantHandle":"rowingblazers","productSlug":"the-croquet-stripe-rugby"},"pathname":"/m/rowingblazers/p/the-croquet-stripe-rugby"}

Notice in the above that the params from useParams now includes the catchAll key in addition to the merchantHandle and productSlug keys. My guess is that the Speed Insights logic might need to be changed to something like "Use the params from a catchAll key if and only if there are no other dynamic params present."

Let me know if I can provide any other info to help debug. Thank you!

feugy commented 6 months ago

Hi @steve-marmalade and tanks a million for the detailed bug report. This should be fixed with version 1.0.11, released this morning.

Please let us know if the fix is effective, and please reopen this ticket accordingly.