Skip to content

fix(blazor): Skip duplicate navigation breadcrumbs in WASM#4922

Merged
bruno-garcia merged 3 commits intomainfrom
fix/blazor-wasm-sample-crash
Feb 13, 2026
Merged

fix(blazor): Skip duplicate navigation breadcrumbs in WASM#4922
bruno-garcia merged 3 commits intomainfrom
fix/blazor-wasm-sample-crash

Conversation

@bruno-garcia
Copy link
Member

@bruno-garcia bruno-garcia commented Feb 13, 2026

Summary

  • Fixes duplicate navigation breadcrumbs in Blazor WASM apps where LocationChanged fires twice for the same URL (e.g. when links use both @onclick+NavigateTo() and href)
  • The fix is in the SDK (BlazorWasmOptionsSetup), not the sample app — customers shouldn't need to change their apps
  • Skips creating a breadcrumb when args.Location matches previousUrl

Test plan

  • New unit test: DuplicateNavigation_SkipsBreadcrumb
  • All 9 unit tests pass (net8.0, net9.0, net10.0)
  • Verified with sample app in browser — navigation creates exactly 1 breadcrumb per click (was 2 before fix)

🤖 Generated with Claude Code


#skip-changelog
justification: #4907 has not been released yet

Copilot AI review requested due to automatic review settings February 13, 2026 16:04
@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:preventDefault to menu links that also have @onclick handlers and href attributes.
  • 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.

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.87%. Comparing base (14ec84f) to head (8ab742f).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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>
@bruno-garcia bruno-garcia force-pushed the fix/blazor-wasm-sample-crash branch from 86b9fe2 to e8905ef Compare February 13, 2026 16:29
@bruno-garcia bruno-garcia changed the title fix(blazor): Prevent duplicate navigation in sample WASM app fix(blazor): Skip duplicate navigation breadcrumbs in WASM Feb 13, 2026
bruno-garcia and others added 2 commits February 13, 2026 11:33
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bruno-garcia bruno-garcia enabled auto-merge (squash) February 13, 2026 16:39
@bruno-garcia bruno-garcia merged commit 6e8d759 into main Feb 13, 2026
30 checks passed
@bruno-garcia bruno-garcia deleted the fix/blazor-wasm-sample-crash branch February 13, 2026 16:46
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