Fix workspace user header null render and ignore .idea

This commit is contained in:
2026-02-26 11:01:15 +01:00
parent d0da35a68c
commit 9036a3a157
4 changed files with 14 additions and 1 deletions

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@ artifacts/
# IDE
.vs/
.idea/
.vscode/*
!.vscode/launch.json
!.vscode/tasks.json

4
FAQ.md
View File

@@ -73,6 +73,10 @@ There is no separate activate button in Play. The selected character in the char
`Home.razor` + `Home.razor.cs` now act as a small gateway that switches between loading, anonymous auth, and workspace views.
Authenticated application state and behavior were moved into `Components/Pages/Workspace.razor`, while reusable concern UI remains under `Components/Pages/HomeControls/`.
## Why does the workspace header sometimes show "Loading user..." briefly?
`Workspace` initializes authenticated session data after the first render (`OnAfterRenderAsync`). During that first render pass, the header now intentionally shows a null-safe fallback label instead of dereferencing user fields before `/api/me` has been loaded.
## Why is auth form state kept in `AuthSection` instead of `Home`?
Auth inputs, validation, and submit workflows are transient UI concerns, so they now live in `AuthSection`. `Home` keeps shared session/workspace state and cross-control refresh/orchestration only.

View File

@@ -9,6 +9,7 @@ Tracking against `UX.md` tasks and decisions.
- Legacy TypeScript frontend/runtime artifacts: removed
- Home was simplified to a minimal gateway (`Loading` / `Anonymous` / `Workspace`) in a single `Home.razor.cs` class.
- The authenticated workspace shell/state/behavior was moved to `Components/Pages/Workspace.razor`.
- Workspace header user identity rendering is now null-safe during first render (`Loading user...` fallback until `/api/me` loads).
- Concern controls now own their local form state and mutation workflows; the workspace host handles shared cross-control state refresh.
- Skill create/edit flow is now owned by `CharacterPanel` (where characters and their skills are presented together).

View File

@@ -25,7 +25,14 @@
<p>Tabletop utility cockpit</p>
</div>
<div class="header-group context">
<p><strong>@User!.DisplayName</strong> <span class="muted">(@User.Username)</span></p>
@if (User is null)
{
<p><strong>Loading user...</strong></p>
}
else
{
<p><strong>@User.DisplayName</strong> <span class="muted">(@User.Username)</span></p>
}
<p>Campaign: <strong>@(SelectedCampaignName ?? "No campaign selected")</strong></p>
<p>Active: <strong>@(ActiveCharacterName ?? "None selected")</strong></p>
</div>