From 6295c4d6d42f1c236288746124ba743e87ee3f5f Mon Sep 17 00:00:00 2001 From: Adam Masiarek Date: Wed, 19 Aug 2026 16:54:33 -0400 Subject: [PATCH] fix(voters): stop showing "Invalid Voter ID" before the voter types anything In an ID-list election the voter-ID field renders in its error state with the helper text "Invalid Voter ID" from the moment the page loads, before the voter has typed a character. First impression of the voting flow: you got it wrong. Cause: VoterAuth.tsx tests voterAuth?.required === "Voter ID Required", but the backend (voterRollUtils.ts getMissingAuthData) returns "Voter ID Required for closed elections". The comparison never matches, so missingVoterID is always false and the error branch (!missingVoterID && !isAuthorized) is true on first paint. Fixed on the frontend side by comparing against the string the backend actually sends. The sibling check ("Email Validation Required") already matches its backend string exactly, which is how the drift went unnoticed -- one of the two worked. With the comparison fixed, the field starts in its neutral state and the error appears only after a submitted ID actually fails. Co-Authored-By: Claude Opus 5 --- packages/frontend/src/components/Election/VoterAuth.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/components/Election/VoterAuth.tsx b/packages/frontend/src/components/Election/VoterAuth.tsx index 94144d1fe..527cfc27e 100644 --- a/packages/frontend/src/components/Election/VoterAuth.tsx +++ b/packages/frontend/src/components/Election/VoterAuth.tsx @@ -44,7 +44,7 @@ const VoterAuth = () => { const isAuthorized = voterAuth?.authorized_voter const missingEmail = voterAuth?.required === "Email Validation Required" - const missingVoterID = voterAuth?.required === "Voter ID Required" + const missingVoterID = voterAuth?.required === "Voter ID Required for closed elections" return (