Skip to content

[release/8.0] [Blazor] Avoid fetching new page content when only the hash changes #53542

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 2 commits into from
Feb 7, 2024

Conversation

MackinnonBuck
Copy link
Member

Avoid fetching new page content when only the hash changes

Backport of #53341

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

Description

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

Customer Impact

Customers' apps may behave unexpectedly by making full page requests rather than scrolling to a location on an already-loaded page. This is inconsistent with the interactive routing behavior, which correctly handles scrolling to elements via hash URL.

Regression?

  • Yes
  • No

Enhanced navigation is a new feature in .NET 8, and this bug has existed since the feature was introduced.

Risk

  • High
  • Medium
  • Low

Most of the changes are moving the "scroll to hash" logic to a location that can be shared between enhanced navigation and interactive routing. The only new logic introduced is that which allows the enhanced navigation logic to hook into that shared behavior.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@MackinnonBuck MackinnonBuck added Servicing-consider Shiproom approval is required for the issue area-blazor Includes: Blazor, Razor Components labels Jan 22, 2024
@MackinnonBuck MackinnonBuck requested a review from a team as a code owner January 22, 2024 23:53
@mkArtakMSFT mkArtakMSFT added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Jan 23, 2024
@ghost
Copy link

ghost commented Jan 31, 2024

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@ghost ghost added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Jan 31, 2024
@wtgodbe
Copy link
Member

wtgodbe commented Feb 6, 2024

@MackinnonBuck can you resolve the conflicts?

@wtgodbe wtgodbe enabled auto-merge (squash) February 6, 2024 22:54
@dotnet-policy-service dotnet-policy-service bot added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Feb 6, 2024
@wtgodbe wtgodbe merged commit c581bf4 into release/8.0 Feb 7, 2024
@wtgodbe wtgodbe deleted the mbuck/backport-53341-to-8.0 branch February 7, 2024 00:22
@dotnet-policy-service dotnet-policy-service bot added this to the 8.0.3 milestone Feb 7, 2024
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 area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun Servicing-approved Shiproom has approved the issue
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants