fix(blazor): Skip duplicate navigation breadcrumbs in WASM#4922
fix(blazor): Skip duplicate navigation breadcrumbs in WASM#4922bruno-garcia merged 3 commits intomainfrom
Conversation
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Blazor WebAssembly sample app’s navigation menu to avoid generating duplicate LocationChanged-driven navigation breadcrumbs when users click links, aligning behavior with the breadcrumb tracking added in #4907.
Changes:
- Adds
@onclick:preventDefaultto menu links that also have@onclickhandlers andhrefattributes. - Prevents the anchor’s default navigation so only the explicit
NavigateTo()call drives route changes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
samples/Sentry.Samples.AspNetCore.Blazor.Wasm/Shared/NavMenu.razor
Outdated
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4922 +/- ##
=======================================
Coverage 73.86% 73.87%
=======================================
Files 496 496
Lines 17921 17927 +6
Branches 3510 3511 +1
=======================================
+ Hits 13237 13243 +6
Misses 3824 3824
Partials 860 860 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When Blazor apps use both @OnClick+NavigateTo and href on links, LocationChanged fires twice for the same URL. Skip creating a breadcrumb when the new location matches the previous one. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
86b9fe2 to
e8905ef
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
LocationChangedfires twice for the same URL (e.g. when links use both@onclick+NavigateTo()andhref)BlazorWasmOptionsSetup), not the sample app — customers shouldn't need to change their appsargs.LocationmatchespreviousUrlTest plan
DuplicateNavigation_SkipsBreadcrumb🤖 Generated with Claude Code
#skip-changelog
justification: #4907 has not been released yet