-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Describe the bug
When navigating between pages with two different layouts, if the page you're navigating from has a CascadingParameter for RouteData, OnInitializedAsync will be called twice on the page you're navigating to.
To Reproduce
I've included a minimal repro here. I've added logging to OnInitializedAsync of the Index, Counter, and Fetch Data pages.
- Start the project and navigate from the Index page to the Counter page.
- Then navigate from Counter to either the Index or Fetch Data
- Observe that OnInitializedAsync is called twice for Index or Fetch Data
This behavior does not occur when Navigating between Index and Fetch Data.
Additionally, I've commented out a second CascadingValue in App.razor which cascades a string. Uncommenting that CascadingValue appears to resolve the issue, even when that value isn't being used on any of the pages. Also, only using the cascading string doesn't appear to reproduce the issue.
Further technical details
.NET Core SDK (reflecting any global.json):
Version: 3.1.300-preview-015048
Commit: 13f19b4682
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.300-preview-015048\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
Microsoft Visual Studio Community 2019
Version 16.5.3