Skip to content

[Blazor] Avoid fetching new page content when only the hash changes #53341

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

Merged
merged 5 commits into from
Jan 19, 2024

Conversation

MackinnonBuck
Copy link
Member

Avoid fetching new page content when only the hash changes

Fixes an issue where a page request is made after clicking a link that only updates the hash part of the URL.

The PR fixes the bug by updating the behavior to match what browsers do by default - if the hash is the only part of the URL that changes, scroll to the element with the ID of the new hash.

This was already implemented correctly for interactive routing, so this PR updates enhanced navigation to share the same logic.

Fixes #52583

@MackinnonBuck MackinnonBuck added the area-blazor Includes: Blazor, Razor Components label Jan 12, 2024
@MackinnonBuck MackinnonBuck requested a review from a team as a code owner January 12, 2024 23:28
Copy link
Member

@javiercn javiercn left a comment

Choose a reason for hiding this comment

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

Looks good to me, but let's address the URL comparison bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blazor: Let browser handle hash change
5 participants