Don't restore page state on first load#8635
Conversation
There was a problem hiding this comment.
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
tests/Aspire.Dashboard.Components.Tests/Shared/TestSessionStorage.cs:34
- The DeleteAsync method is implemented as a no-op stub. Consider adding test cases to verify deletion behavior to ensure consistency with production implementations.
public Task DeleteAsync(string key)
tests/Aspire.Dashboard.Components.Tests/Shared/TestLocalStorage.cs:42
- The new DeleteAsync stub here would benefit from tests that confirm its intended use, especially given its role in state management.
public Task DeleteAsync(string key)
|
|
||
| protected override async Task OnInitializedAsync() | ||
| { | ||
| NavigationManager.LocationChanged += (_, _) => NavigationService.IsFirstPageLoad = false; |
There was a problem hiding this comment.
Consider unsubscribing from the NavigationManager.LocationChanged event in the component's Dispose method to prevent potential memory leaks.
|
I couldn't understand the problem from your description. Could you add a recording of the problem? |
|
I noticed that this only happens when a following slash is not added to the url (ie, repros with |
Description
I noticed that there's a bug with the current "state restore" logic. If you navigate intentionally to a different url (ie by updating the url in the omnibar and navigating), the existing page state will still be restored.
This disables state restore just for the initial page load. The main purpose of this state restoration logic is to restore state when navigating between pages, which isn't touched.
Checklist
<remarks />and<code />elements on your triple slash comments?breaking-changetemplate):doc-ideatemplate):