fix: correct BatchUpload comments — no prerender pass on this host, single init pass on live interactive circuit

This commit is contained in:
daniel-c-harvey
2026-06-19 23:23:16 -04:00
parent bd9c67fc65
commit a30d15f79d
@@ -129,10 +129,9 @@
// Set true once the admin has acknowledged the missing-hero warning, so a second submit proceeds. // Set true once the admin has acknowledged the missing-hero warning, so a second submit proceeds.
private bool _heroWarningAcknowledged; private bool _heroWarningAcknowledged;
// Captured at component initialization (when the token is known-good) so a mid-session // Captured once at component initialization on the live interactive circuit, while the token
// token expiry at submit time cannot discard a long-composed release. Only assigned when // is known-good, so a mid-session token expiry at submit time cannot discard a long-composed
// the id parses successfully — a prerender pass returns an anonymous principal (no JS // release. Only assigned when the id parses successfully.
// interop available), so the field stays null until the live interactive circuit populates it.
private long? _createdByUserId; private long? _createdByUserId;
private string _albumName = string.Empty; private string _albumName = string.Empty;
@@ -164,10 +163,9 @@
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
// Capture the user id once at load, while the token is known-good. The page is [Authorize]-gated // Capture the user id once at load, while the token is known-good. The CMS host runs with
// so this should always succeed on the live interactive circuit. During static prerender, auth // prerender: false (InteractiveServer), so this is the single init pass — auth state is
// state is anonymous (no JS interop → no localStorage JWT read), so the parse fails and the // fully available. The page is [Authorize]-gated, so the parse should always succeed.
// field stays null; the interactive circuit then runs this again and sets the real value.
var authState = await AuthStateProvider.GetAuthenticationStateAsync(); var authState = await AuthStateProvider.GetAuthenticationStateAsync();
var userIdValue = authState.User.FindFirstValue(ClaimTypes.NameIdentifier); var userIdValue = authState.User.FindFirstValue(ClaimTypes.NameIdentifier);
if (long.TryParse(userIdValue, out var userId)) if (long.TryParse(userIdValue, out var userId))