fix: login button stuck on 준비 중 - Blazor hydration reverted JS enable
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m24s

AdminLoginForm's submit button had disabled hardcoded as static markup, not
bound to component state. The early inline <script> (before WASM boots)
flipped it via raw DOM mutation, but when the WASM runtime later resumed the
prerendered component, Blazor's own first render re-asserted the static
disabled from the markup - silently undoing the JS fix. The second
bindLoginForm() call from OnAfterRenderAsync then bailed out immediately on
the one-shot "already bound" guard, so nothing ever re-enabled it.

Fix: bind disabled to a real isReady field flipped in OnAfterRenderAsync so
Blazor owns that attribute going forward, and make the JS-side enable
idempotent (runs on every call, not gated behind the bind-once guard) as a
second line of defense.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 10:24:51 +09:00
parent e5981769b9
commit 83c1254a3e
2 changed files with 22 additions and 8 deletions
@@ -29,10 +29,10 @@
<button type="submit"
id="admin-login-submit"
disabled
disabled="@(!isReady)"
class="mud-button-root mud-button mud-button-filled mud-button-filled-primary mud-elevation-0"
style="width: 100%; min-height: 52px; border: 0; border-radius: 4px; color: white;">
<span>준비 중...</span>
<span>@(isReady ? "로그인" : "준비 중...")</span>
</button>
</form>
</MudPaper>
@@ -40,6 +40,7 @@
@code {
private string rememberedUsername = "";
private bool isReady;
private const string RememberedUsernameKey = "admin-remembered-username";
protected override async Task OnInitializedAsync()
@@ -67,6 +68,15 @@
{
// Login UI must remain visible even if JS binding fails.
}
finally
{
// Blazor owns this render from here on, so drive "disabled" from
// C# state rather than a raw DOM mutation - otherwise this hydration
// pass re-asserts the prerendered markup's static "disabled" and
// silently undoes whatever the early inline <script> already set.
isReady = true;
StateHasChanged();
}
}
}
}