climbjios-sg / climbjios-app

The community for climbers 🧗
https://www.climbjios.com/
GNU General Public License v3.0
25 stars 4 forks source link

fix: non number inputs are skipped for height and reach fields during onboarding on Safari #254

Closed nathantew14 closed 1 year ago

nathantew14 commented 1 year ago

Describe your changes

Issue is that the type = "number" prop of input fields does not correctly prevent non-numbers from being entered on Safari, but also prevents the input itself from being passed to the object of values used by react-hook-form, as well as mutes the onChange method, so the invalid height and reach entries are simply skipped (and cannot otherwise be checked)

To fix this, I moved the handleClickDoneButton method to the onSubmit method/prop of FormProvider, then changed the "Skip"/"Next" button to invoke the onSubmit method, so that the default React's form validation which happens upon submitting a form can be used for each page of the onboarding process (without actually submitting the user info to backend).

Issue ticket number and link

109

Screenshots (if appropriate):

Screenshot 2022-12-25 at 7 10 46 PM

Checklist before requesting a review

Does not seem to affect any behaviour on Chrome, updateUser can still be submitted at the end of the onboarding form, and EditProfile seems to still work.

therizhao commented 1 year ago

Hi @nathantew14 u might want to check the lock file. I think can uncommit the changes in the lock file

therizhao commented 1 year ago

otherwise lgtm

nathantew14 commented 1 year ago

@therizhao after much gnashing of teeth I managed to remove the commit that changed the lock file, but now neither my backend nor frontend can be started with yarn locally

however, they can be started in my other local branches with the exact same lock files, so I'm really completely lost here

therizhao commented 1 year ago

@all-contributors please add @nathantew14 for code

allcontributors[bot] commented 1 year ago

@therizhao

I've put up a pull request to add @nathantew14! :tada: