.NET 8 Blazor - Navigation - AuthenticationStateProvider Bug #58009
Labels
area-blazor
Includes: Blazor, Razor Components
Needs: Author Feedback
The author of this issue needs to respond in order for us to continue investigating this issue.
Needs: Repro
Indicates that the team needs a repro project to continue the investigation on this issue
Status: No Recent Activity
Is there an existing issue for this?
Describe the bug
A very interesting issue. I have a NavMenu that loads dynamic NavItems. I built a nice template and created the following element for subitems:
In the past few days, I was desperately trying to figure out why client-side rendered components were behaving strangely. As long as a NavItem had no subitems, my UserService, which accesses the AuthenticationStateProvider, worked without any issues. However, when I navigated using a subitem, the AuthenticationState was always "Unauthenticated". After removing any potential sources of error from the components (the components are, in this case, pages), the only remaining possible issue was the navigation. Interestingly, the AuthState was correctly loaded when I navigated directly via the browser link.
The issue can easily be resolved by embedding an HTML element in the @subItem.Name. But so the enhanced navigation wont work anymore. So maybe this is the problem.
Update:
Its definitive caused by enhanced navigation, if you set
data-enhance-nav="false"
the problem is gone, but the navbar always reloads...Expected Behavior
AuthenticationStateProvider returns IsAuthenticated = false
Steps To Reproduce
Navigate with this NavLink:
Exceptions (if any)
IsAuthenticated = false
.NET Version
8.0.400
Anything else?
The problem also occurs, if you simply use the
<a>
Tag. So its not based on the<NavLink />
No response
The text was updated successfully, but these errors were encountered: