Skip to content

bug: Long-term mentee registration Submit silently does nothing when availableHsMonth is invalid #296

Description

@yingliu-data

Bug Report

For long-term cycles, the mentee-registration Submit button can silently do nothing: the form fails validation on a field that is not shown on the final step, so no error is displayed.

  • src/schemas/menteeSchema.ts (superRefine) requires availableHsMonth >= 2 for LONG_TERM (and >= 1 for AD_HOC); the default value is 0.
  • src/pages/mentorship/mentee-registration.tsxvalidateStep1 (the step-1 trigger([...]) list) does not include availableHsMonth, yet the field is rendered on step 1. The final submit uses handleSubmit(onSubmit) with no onInvalid handler.

Reproduction (when IS_ADHOC_CYCLE=false)

  1. User leaves "Available hours per month" at its default 0 (or enters 1).
  2. Step 1 passes because availableHsMonth is not in the step-1 trigger list.
  3. User reaches the final step and clicks Submit.
  4. The resolver fails on availableHsMonth, whose input lives on step 1, so no error renders anywhere — the button appears dead and nothing happens.

Currently dormant because IS_ADHOC_CYCLE=true, but it will affect every long-term cycle.

Severity

High (dormant today; breaks every long-term cycle when ad-hoc mode is off)

Potential Risk

  • Mentees silently unable to submit long-term applications, with no visible reason.

Suggested Fix

  • Add availableHsMonth to the step-1 trigger list so it is validated on the step where it is rendered and the error is shown in context.
  • Add an onInvalid handler to handleSubmit that surfaces validation errors (e.g. focuses/scrolls to the first invalid field or shows a summary) so a failed submit is never silent.
  • Add a test covering long-term submission with availableHsMonth below the threshold (expect a visible validation error, not a no-op).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions