Refactor session store (WIP)
4 files changed, 36 insertions, 19 deletions
diff --git a/MatrixUtils.Web/Shared/MainLayout.razor b/MatrixUtils.Web/Shared/MainLayout.razor
index 0392d9a..c06fe5a 100644
--- a/MatrixUtils.Web/Shared/MainLayout.razor
+++ b/MatrixUtils.Web/Shared/MainLayout.razor
@@ -1,24 +1,41 @@
@inherits LayoutComponentBase
-<div class="page">
- <div class="sidebar">
- <NavMenu/>
+@if (_isLoaded) {
+ <div class="page">
+ <div class="sidebar">
+ <NavMenu/>
+ </div>
+
+ <main>
+ <div class="top-row px-4">
+ @* <PortableDevTools/> *@
+ @* <ResourceUsage/> *@
+ <a style="color: #ccc; text-decoration: underline" href="https://cgit.rory.gay/matrix/tools/MatrixUtils.git/" target="_blank">Git</a>
+ <a style="color: #ccc; text-decoration: underline" href="https://matrix.to/#/%23mru%3Arory.gay?via=rory.gay&via=matrix.org&via=feline.support"
+ target="_blank">Matrix</a>
+ </div>
+
+ <article class="Content px-4">
+ @Body
+ </article>
+
+
+ </main>
</div>
+}
+else {
+ <p>Attaching session store, please wait...</p>
+}
- <main>
- <div class="top-row px-4">
- @* <PortableDevTools/> *@
- @* <ResourceUsage/> *@
- <a style="color: #ccc; text-decoration: underline" href="https://cgit.rory.gay/matrix/tools/MatrixUtils.git/" target="_blank">Git</a>
- <a style="color: #ccc; text-decoration: underline" href="https://matrix.to/#/%23mru%3Arory.gay?via=rory.gay&via=matrix.org&via=feline.support" target="_blank">Matrix</a>
- </div>
+<UpdateAvailableDetector/>
- <article class="Content px-4">
- @Body
- </article>
+@code {
+ private bool _isLoaded;
- </main>
-</div>
+ protected override async Task OnInitializedAsync() {
+ await sessionStore.EnsureInitialized();
+ _isLoaded = true;
+ }
-<UpdateAvailableDetector/>
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/MatrixUtils.Web/Shared/PolicyEditorComponents/PolicyEditorModal.razor b/MatrixUtils.Web/Shared/PolicyEditorComponents/PolicyEditorModal.razor
index a1d870c..5819bee 100644
--- a/MatrixUtils.Web/Shared/PolicyEditorComponents/PolicyEditorModal.razor
+++ b/MatrixUtils.Web/Shared/PolicyEditorComponents/PolicyEditorModal.razor
@@ -56,7 +56,7 @@
break;
case Type t when t == typeof(DateTime):
if (!isNullable) {
- <InputDate TValue="DateTime" Value="@(getter?.Invoke(PolicyData, null) as DateTime? ?? new DateTime())" ValueChanged="@(e => { Console.WriteLine($"{prop.Name} ({setter is not null}) -> {e}"); setter?.Invoke(PolicyData, [e]); PolicyEvent.TypedContent = PolicyData; StateHasChanged(); })"></InputDate>
+ @* <InputDate TValue="DateTime" Value="@(getter?.Invoke(PolicyData, null) as DateTime? ?? new DateTime())" ValueChanged="@(e => { Console.WriteLine($"{prop.Name} ({setter is not null}) -> {e}"); setter?.Invoke(PolicyData, [e]); PolicyEvent.TypedContent = PolicyData; StateHasChanged(); })"></InputDate> *@
}
else {
var value = getter?.Invoke(PolicyData, null) as DateTime?;
diff --git a/MatrixUtils.Web/Shared/RoomListItem.razor b/MatrixUtils.Web/Shared/RoomListItem.razor
index 46daaa2..2d85f64 100644
--- a/MatrixUtils.Web/Shared/RoomListItem.razor
+++ b/MatrixUtils.Web/Shared/RoomListItem.razor
@@ -141,7 +141,7 @@ else {
protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync();
- // hs ??= await RmuStorage.GetCurrentSessionOrNavigate();
+ // hs ??= await sessionStore.GetCurrentHomeserver(navigateOnFailure: true);
// if (hs is null) return;
if (Homeserver is null) {
diff --git a/MatrixUtils.Web/Shared/UserListItem.razor b/MatrixUtils.Web/Shared/UserListItem.razor
index 8ce2868..5084807 100644
--- a/MatrixUtils.Web/Shared/UserListItem.razor
+++ b/MatrixUtils.Web/Shared/UserListItem.razor
@@ -29,7 +29,7 @@
private SvgIdenticonGenerator _identiconGenerator = new();
protected override async Task OnInitializedAsync() {
- // _homeserver = await RmuStorage.GetCurrentSessionOrNavigate();
+ // _homeserver = await sessionStore.GetCurrentHomeserver(navigateOnFailure: true);
// if (_homeserver is null) return;
if (User == null) {
|