afoGroup/webdev-sp21-afo-client-react

Register Username field does not update to new value until register button clicked at least twice.

Opened this issue · 2 comments

Posting an issue for us to assess at a later date if necessary. Calling this out after doing some internal testing and trying to track down why I could consistently post a bad data point that was nowhere near the user arguments on the front-end. Figured that if we can figure out how to tackle this, I can implement the change in tom-client and we merge at a later date (as it already tackles another issue Tiff called out that has yet to be merged).

Replication Steps:
(1) At client startup, navigate to the Registration page.
(2) Fill out the Registration ticket. (*NOTE, if you do not want to post the bad data point to the DB, comment out lines 50-53 of the registration component and add 'console.log(credentials)').
(3) Click register. If the posting has been disabled, notice that console logging shows an empty JSON object. If posting is enabled however, you will post a blank datapoint to the database.

Impact:
-If there exists a blank value in the DB already, this is not as impactful as it could be; the real issue here is that the react-client will tag this as a successful login, navigating the user away to the home screen. If the user would then like to login at a later date, none of the credentials would have actually saved.
-Suppose instead you got around this in the first iteration and now have a username that exists in the DB; a similar issue can be replicated where changing your username will cache the original username argument for one click of the register button - changes will not persist until you click register again. If you do this quickly, you can actually post more than one unique username to the DB.

Next Steps:
-Is there a way we can control for this other than directly in the register method that is being called? This seems to be a similar flavor to the issue we encountered a while back with having to click 'Search' twice in the Anime Search component. I suppose a control would be for there to prevent the user from posting to the DB unless they double-click the button, but unsure if this moves away from best practice or not.

Best,
Tom

For register, there's some additional stuff I found:

  • I register tchen10 -> sends empty to DB -> client navs to home / can't login with this info -> tries to reregister tchen10 doesnt work and says that Username has already been taken 🤦‍♀️ These bugs.... lol...

Screen Shot 2021-04-23 at 5 21 54 PM
Seems to be otaku specific - alerts and then sends correct info after 2nd click...