diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-05-27 02:23:30 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-05-27 02:23:30 +0200 |
commit | ac7ed016b00941380099d9a0b2601f4bc353f39f (patch) | |
tree | a0f9fc1baee763a528aef2cd04a920815ef3906d /MatrixRoomUtils.Web/Pages/RoomManager | |
parent | Been a while since I last committed (diff) | |
download | MatrixUtils-ac7ed016b00941380099d9a0b2601f4bc353f39f.tar.xz |
Remove a bunch of caching, make room listings more reliable
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/RoomManager')
3 files changed, 11 insertions, 7 deletions
diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManager.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManager.razor index 35bf501..a8b8fd4 100644 --- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManager.razor +++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManager.razor @@ -20,7 +20,7 @@ else @foreach (var room in Spaces) { <a style="color: unset; text-decoration: unset;" href="/RoomManager/Space/@room.RoomId.Replace('.', '~')"> - <RoomListItem Room="@room" ShowOwnProfile="true"></RoomListItem> + <RoomListItem Room="@room" ShowOwnProfile="false"></RoomListItem> </a> } </details> @@ -44,19 +44,23 @@ else protected override async Task OnInitializedAsync() { + Console.WriteLine("Initializing room manager"); await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage); + Console.WriteLine("Loaded from local storage"); await base.OnInitializedAsync(); + Console.WriteLine("Initialized base"); if (RuntimeCache.CurrentHomeServer == null) { NavigationManager.NavigateTo("/Login"); return; } - Rooms = await RuntimeCache.CurrentHomeServer.GetJoinedRooms(); + Console.WriteLine("Fetching joined rooms"); + var _rooms = await RuntimeCache.CurrentHomeServer.GetJoinedRooms(); StateHasChanged(); - Console.WriteLine($"Got {Rooms.Count} rooms"); + Console.WriteLine($"Got {_rooms.Count} rooms"); var semaphore = new SemaphoreSlim(10); var tasks = new List<Task<Room?>>(); - foreach (var room in Rooms) + foreach (var room in _rooms) { tasks.Add(CheckIfSpace(room, semaphore)); } @@ -81,7 +85,6 @@ else { Console.WriteLine($"Room {room.RoomId} is a space!"); Spaces.Add(room); - Rooms.Remove(room); StateHasChanged(); return room; } @@ -92,6 +95,7 @@ else } else { + Rooms.Add(room); //this is fine, apprently... // Console.WriteLine($"Room {room.RoomId} has no Content.type in m.room.create!"); } diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor index 7b4db37..8cbbca6 100644 --- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor +++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor @@ -79,7 +79,7 @@ <details> @code{ - private static string[] ImplementedStates = new[] { "m.room.avatar", "m.room.history_visibility", "m.room.guest_access", }; + private static readonly string[] ImplementedStates = { "m.room.avatar", "m.room.history_visibility", "m.room.guest_access", }; } <summary>@creationEvent.InitialState.Count(x => !ImplementedStates.Contains(x.Type)) custom states</summary> diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor index a44b2b4..e9d1421 100644 --- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor +++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor @@ -16,7 +16,7 @@ @foreach (var stateEvent in States.OrderBy(x => x.StateKey).ThenBy(x => x.Type)) { <p>@stateEvent.StateKey/@stateEvent.Type:</p> - <pre>@stateEvent.content.ToJson()</pre> + <pre>@stateEvent.Content.ToJson()</pre> } </details> |