-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MyProfile - Validate input string for empty values #204
base: main
Are you sure you want to change the base?
MyProfile - Validate input string for empty values #204
Conversation
The problem I see with this implementation is that it really isn't validating anything. Values are stored regardless of the toast notification saying that the input cannot be empty. First, we need to question ourselves what are the use cases:
Try to focus on that, and lets boost this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's improve this PR focusing on the user experience described above
There are two aspects that need to be considered here.
The scenarios mentioned by @cyntss can be divided into either of the above-mentioned categories. Consider the below as per the given scenarios:
I think this covers most of the cases. |
b383aeb
to
5c7eb2c
Compare
I've improved the PR that focuses on UX and displays relevant toast messages as per the actions depicted in the above table. |
Issue Number
fixes #203
Describe the changes you've made
The
handleInputChange
callback is triggered on every keypress, also the user information is updated on every keypress and stored in the state variableuser
of theMyProfile
component. However, when the save icon is pressed to update the information, no validation is done to check whether the field that was currently being updated is actually updated or not(Specifically, checking if any empty value has been passed or not). Skipping such validation results in unnecessary network calls. Hence, in thehandleInputChange
cb, I have set up a state updating function that updates the currently updating field on every keystroke. Thus, when the save icon is pressed, we can verify if the updated field holds any string or not(by checking its length). If it happens to be an empty string, an error toast is fired sayingInput can not be empty.
This ensures that the user actually enters a non-empty input.Describe if there is any unusual behavior (Any Warning) of your code(Write
NA
if there isn't)NA
Additional context (OPTIONAL)
Test plan (OPTIONAL)
A good test plan should give instructions that someone else can easily follow.
Navigate to My Profile (/myProfile).
Click on the pencil icon of any input fields.
Click on the save icon leaving the input field empty.
You can notice an error toast pop up.
Checklist
Provide a Deployed link of route/page that needs to review
Preview: Deploy preview link here with the appropriate route