From a069cfd6a0f7c53b902607e79037ffd90681a7b9 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Thu, 11 May 2023 20:56:16 +0200 Subject: Add state cache --- MatrixRoomUtils.Web/Shared/NavMenu.razor | 9 +++++++++ MatrixRoomUtils.Web/Shared/RoomListItem.razor | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'MatrixRoomUtils.Web/Shared') diff --git a/MatrixRoomUtils.Web/Shared/NavMenu.razor b/MatrixRoomUtils.Web/Shared/NavMenu.razor index 0027901..a033925 100644 --- a/MatrixRoomUtils.Web/Shared/NavMenu.razor +++ b/MatrixRoomUtils.Web/Shared/NavMenu.razor @@ -14,6 +14,10 @@ Home + + + diff --git a/MatrixRoomUtils.Web/Shared/RoomListItem.razor b/MatrixRoomUtils.Web/Shared/RoomListItem.razor index d2c844d..15ca5c0 100644 --- a/MatrixRoomUtils.Web/Shared/RoomListItem.razor +++ b/MatrixRoomUtils.Web/Shared/RoomListItem.razor @@ -33,6 +33,12 @@ protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); + + if(!RuntimeCache.WasLoaded) { + Console.WriteLine("Loading from local storage"); + await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage); + } + if (Room == null) { if (RoomId == null) @@ -80,7 +86,7 @@ { hasCustomProfileName = _name.GetString() != profile.DisplayName; profileName = _name.GetString(); - Console.WriteLine($"{profile.DisplayName} - {_name.GetString()}: {hasCustomProfileName}"); + // Console.WriteLine($"{profile.DisplayName} - {_name.GetString()}: {hasCustomProfileName}"); } else { @@ -88,6 +94,8 @@ } } } + if(Random.Shared.Next(100) == 1) + await LocalStorageWrapper.SaveToLocalStorage(LocalStorage); } } \ No newline at end of file -- cgit 1.5.1