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.
private bool _heroWarningAcknowledged;
// Captured at component initialization (when the token is known-good) so a mid-session
// token expiry at submit time cannot discard a long-composed release. Only assigned when
// the id parses successfully — a prerender pass returns an anonymous principal (no JS
// interop available), so the field stays null until the live interactive circuit populates it.
// Captured once at component initialization on the live interactive circuit, while the token
// is known-good, so a mid-session token expiry at submit time cannot discard a long-composed
// release. Only assigned when the id parses successfully.
private long? _createdByUserId;
private string _albumName = string.Empty;
@@ -164,10 +163,9 @@
protected override async Task OnInitializedAsync()
{
// Capture the user id once at load, while the token is known-good. The page is [Authorize]-gated
// so this should always succeed on the live interactive circuit. During static prerender, auth
// state is anonymous (no JS interop → no localStorage JWT read), so the parse fails and the
// field stays null; the interactive circuit then runs this again and sets the real value.
// Capture the user id once at load, while the token is known-good. The CMS host runs with
// prerender: false (InteractiveServer), so this is the single init pass — auth state is
// fully available. The page is [Authorize]-gated, so the parse should always succeed.
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
var userIdValue = authState.User.FindFirstValue(ClaimTypes.NameIdentifier);
if (long.TryParse(userIdValue, out var userId))