Stop application forms from sending isSelected (approval reset bug) - #351
Merged
Conversation
Every application edit was sending isSelected: false from the form's initial state (sponsor hardcoded it in the payload), which the backend used to honor — silently un-approving approved mentors, judges, volunteers, and sponsors on every update. - Remove isSelected from initialFormData in mentor/volunteer/sponsor/ hacker forms, the hardcoded payload field in sponsor, and the hydration round-trip in hacker. - Remove judge's vestigial `selected` form field and its dead hidden input (the form submits via fetch, not native POST). - Approval is now server-authoritative: the backend strips staff-owned fields from self-service submits (backend PR pairs with this). The isSelected React state used for UI gating (QR cards, feedback CTA) is a separate variable and is untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Editing and re-submitting an application silently un-approved the applicant: four of the five forms sent
isSelected: falsefrom their initial form state on every submit (mentor/volunteer via...formDataspread, sponsor hardcoded in the payload, hacker round-tripped it), and the backend honored a client-supplied value.Changes
isSelectedfrominitialFormDatain mentor / volunteer / sponsor / hacker forms, the hardcoded payload field in sponsor, and the hydration round-trip in hacker — with comments so it doesn't get "helpfully" re-added.selectedform field and its dead<input type="hidden">(the form submits viafetch; the input contributed nothing but the stray field was persisted to Firestore on every judge submit).isSelectedReact state used for UI gating (check-in QR, feedback CTA) is a separate variable and is untouched — no behavior change for approved users.Pairs with
opportunity-hack/backend-ohack.dev#268 — the load-bearing half: the backend now strips staff-owned fields (
isSelected, check-in, refund bookkeeping) from all self-service submits, which also covers stale localStorage drafts and the decline-the-restore-prompt path this frontend change can't reach. No deploy-order constraint in either direction.Testing
formData.isSelected/formData.selectedreads anywhere insrc/.🤖 Generated with Claude Code