-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Blazor: expose 'replace' parameter in NavigationManager.NavigateTo #25540
Copy link
Copy link
Closed
Labels
affected-fewThis issue impacts only small number of customersThis issue impacts only small number of customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the futureFeatures related to the built in components we ship or could ship in the futurehelp wantedUp for grabs. We would accept a PR to help resolve this issueUp for grabs. We would accept a PR to help resolve this issueseverity-majorThis label is used by an internal toolThis label is used by an internal tool
Milestone
Metadata
Metadata
Assignees
Labels
affected-fewThis issue impacts only small number of customersThis issue impacts only small number of customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the futureFeatures related to the built in components we ship or could ship in the futurehelp wantedUp for grabs. We would accept a PR to help resolve this issueUp for grabs. We would accept a PR to help resolve this issueseverity-majorThis label is used by an internal toolThis label is used by an internal tool
Type
Fields
Give feedbackNo fields configured for issues without a type.
Is your feature request related to a problem? Please describe.
I want to maintain some of my view state in the URL, such as the currently selected tab. I can and do use
window.history.replaceStatefor this, but theNavigationManager.Uriis then out of sync. I'd like to be able to keep theUriin sync, as I'm using it to help manage this state. I need to get theUrisynchronously so I can't just calllocation.hrefusing interop.Describe the solution you'd like
Simple option
I believe the simplest solution would be to make
NavigationManager.Urisettable publicly so I can then perform this task myself. I don't want to have to implement my ownNavigationManagerjust for this purpose. It is already clear in the docs that settingUridoesn't triggerLocationChanged, which again, is my desired behavior, so hopefully making this public isn't too big of a concern.Fancier option
The other option is to expose the
replacethat already exists innavigateTo()inNavigationManager.ts. However... I don't want to triggerOnParametersSetin my scenario, and I think this would do so by default. Personally, I'd like to submit a PR for the first option and leave this one on the table.