Repository navigation
fix: keep hash routes in performance and heatmap paths - #4644
Open
DahanItamar wants to merge 1 commit into
Open
DahanItamar wants to merge 1 commit into
DahanItamar wants to merge 1 commit into
Conversation
Pageviews store `pathname + hash`, but performance events and heatmap clicks/scrolls store only `pathname`. On sites that use a hash router, every route's Web Vitals and heatmap data collapse into `/`. Keep the hash when it is a router path (`#/...` or `#!/...`), without its query. Plain in-page anchors such as `#install` are still dropped, so heatmaps and performance for other sites are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@DahanItamar is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
[Medium impact] The PR appears safe to merge. SummaryKeeps hash-router paths in Performance and Heatmaps while leaving plain in-page anchors out.
No actionable issues found. Tests were inspected but not run.
|
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported in #4642.
Problem
On sites that use a hash router (
https://app.example.com/#/orders/42), pageviews are split by route, but Performance and Heatmaps put everything on/. The three collection paths deriveurl_pathdifferently:/#/orders/42is saved assrc/app/api/send/route.ts(event branch)/#/orders/42src/app/api/send/route.ts(performance branch)/getUrlPathinsrc/app/api/record/route.ts/So every route's Web Vitals are averaged together, and all heatmap clicks land on the start page. The tracker's
data-before-sendcan work around Performance, but the recorder has no hook, so Heatmaps can't be fixed client-side.Change
getHashRoutetosrc/lib/url.ts. It returns the hash when it's a router path (#/...or#!/...), without the query inside the hash, and''otherwise./api/sendand ingetUrlPathin/api/record(both the absolute-URL and relative-URL cases).Plain in-page anchors such as
/docs#installare still saved as/docs, so Performance and Heatmaps don't change for sites that don't use a hash router. Heatmaps don't get split by every anchor, andgetHeatmap's iframe preview URL (new URL(urlPath, origin)) now points at the actual hash route instead of the start page.Tests
src/lib/url.test.ts:getHashRoutefor#/and#!/routes, a query inside the hash, a plain anchor, and empty input.src/app/api/send/route.test.ts: performance events for/#/orders/42,/#!/orders/42,/#/settings?tab=2and/docs#install.src/app/api/record/route.test.ts: a heatmap batch with absolute and relative URLs, hash routes and anchors.The hash-route cases fail on
devand pass with this change. The anchor cases pass on both, so normal sites see no change. The fullpnpm testsuite passes (135 files, 1065 tests) afterpnpm build:packages.biome checkreports nothing for the changed lines. Its only finding in these files is an existing formatting difference atsend/route.test.tsline 107, which I left untouched.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.