[frontend] Refactor initial load in single note view.

This commit is contained in:
Lilian 2024-09-15 03:46:38 +02:00
parent a9d42b214a
commit 9b07868a60
No known key found for this signature in database

View file

@ -80,6 +80,7 @@
private IDisposable? _locationChangingHandlerDisposable;
private IDisposable? _noteChangedHandler;
private LoadState _componentState;
private bool _firstLoad = true;
private enum LoadState
{
@ -89,7 +90,7 @@
Deleted
}
protected override async Task OnParametersSetAsync()
private async Task Load()
{
Logger.LogTrace($"Opening NoteID: {NoteId}");
_componentState = LoadState.Loading;
@ -122,7 +123,21 @@
}
_componentState = LoadState.Init;
}
protected override async Task OnInitializedAsync()
{
await Load();
}
protected override async Task OnParametersSetAsync()
{
if (_firstLoad)
{
_firstLoad = false;
return;
}
await Load();
StateHasChanged();
}