Skip to content
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

LocationChanged event and location changing handlers interaction with enhanced navigation 8.0 #30876

Closed
guardrex opened this issue Oct 30, 2023 · 2 comments · Fixed by #30884
Closed
Assignees
Labels
8.0 .NET 8 Blazor doc-enhancement Pri1 High priority, do before Pri2 and Pri3

Comments

@guardrex
Copy link
Collaborator

Description

When an enhanced navigation occurs, LocationChanged event handlers registered in interactive runtimes (i.e., Blazor Server/WebAssembly) get invoked. However, location changing handlers may or may not intercept enhanced navigations, so it's important that app logic not rely on location changing handlers being invoked reliably. For example, the user might switch to another page before an interactive runtime becomes available. In .NET 8, if server-side routing and enhanced navigation are enabled, location changing handlers will only get invoked for programmatic navigations initiated from an interactive runtime. In future .NET versions, more types of navigations (e.g., link clicks) may also invoke location changing handlers"

Per dotnet/aspnetcore#51436 (comment)

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing?view=aspnetcore-7.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/fundamentals/routing.md

Document ID

b6cb2574-6326-a40d-0b6c-d1661328e828

Article author

guardrex

@guardrex guardrex added Pri1 High priority, do before Pri2 and Pri3 Source - Docs.ms Docs Customer feedback via GitHub Issue doc-enhancement ⌚ Not Triaged 8.0 .NET 8 labels Oct 30, 2023
@guardrex guardrex removed the Source - Docs.ms Docs Customer feedback via GitHub Issue label Oct 30, 2023
@dotnet dotnet deleted a comment from github-actions bot Oct 30, 2023
@guardrex guardrex changed the title LocationChanged event and location changing handlers interaction with enhanced navigation LocationChanged event and location changing handlers interaction with enhanced navigation 8.0 Oct 31, 2023
@garrettlondon1
Copy link

@guardrex I just read dotnet/aspnetcore#51436 coincidentally and just want to clarify:

If you are rendering a fully static page with an InteractiveServer island

  • That island depends on catching external navigations

The InteractiveServer island will be unable to catch any LocationChanged events outside of its HTML purview? The only solution is to make the entire surrounding page Interactive with pre-rendering?

@guardrex
Copy link
Collaborator Author

Due to the complexity of the question, it's best to open a product support request on that ...

https://github.com/dotnet/aspnetcore/issues

Please add ...

cc: @guardrex

... your opening issue comment so that I can follow the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.0 .NET 8 Blazor doc-enhancement Pri1 High priority, do before Pri2 and Pri3
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants