Fix e migliorati caricamenti
This commit is contained in:
@@ -4,11 +4,13 @@
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Dto.PageState
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Messages.Activity.New
|
||||
@inject IManageDataService ManageData
|
||||
@inject IJSRuntime JS
|
||||
@inject NewActivityService NewActivity
|
||||
@inject UserListState UserState
|
||||
|
||||
<HeaderLayout Title="@_headerTitle"
|
||||
ShowFilter="true"
|
||||
@@ -168,7 +170,6 @@
|
||||
<FilterActivity @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="ApplyFilter"/>
|
||||
|
||||
@code {
|
||||
|
||||
// Modelli per ottimizzazione rendering
|
||||
private record DayData(DateTime Date, string CssClass, bool HasEvents, CategoryData[] EventCategories, string DayName = "");
|
||||
|
||||
@@ -221,11 +222,20 @@
|
||||
PrepareRenderingData();
|
||||
|
||||
NewActivity.OnActivityCreated += async activityId => await OnActivityCreated(activityId);
|
||||
UserState.OnUsersLoaded += async () => await InvokeAsync(LoadData);
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
if (firstRender && UserState.IsLoaded)
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
if (!_isInitialized)
|
||||
{
|
||||
Filter.User = new HashSet<string> { UserSession.User.Username };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user