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.
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
feat(search): Debounce and phone number validation #3124
feat(search): Debounce and phone number validation #3124
Changes from 4 commits
74f0c59
f1ee5ff
f9f000a
3effa64
cf25b91
2000719
8a8b1cf
4c41ecc
39581a4
429d9aa
cfb09ce
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I think none of the changes in this file are needed, the only difference I can see that your changes make is they reduce the padding below the following
TextInputWithFocusStyles
, but I think it looks find with the original padding. Is there any other change you were trying to make with these style updates?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.
Reverting back
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.
This change isn't necessary - please try to keep lines the same as before, unless you're changing something in the line(s).
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.
I believe we're going to have to move this into
OptionsListUtils
since the validation you're adding is going to apply to all pages that have account-search functionality. Can you figure out how we can reusegetSearchOptions
here (by editinggetOptions
)? I'm thinking we can havegetOptions
also returnheaderMessage
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.
I discussed this with you earlier. That my initial approach was to add the changes in
getOptions
only but it's not flexible enough and might require good amount of refactoring.Because there are a lot of things happening internally and the code is a bit messy and adding more code will increase the complexity and maintainability efforts.
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.
Woah you did? I'm sorry I don't remember you bringing up that approach, maybe I misunderstood :O
Hmm I don't see why we can't refactor
getHeaderMessage
just a bit, and makegetOptions
also return something likeheaderMessage: getMeaderMessage(...)
. Here's why I'm thinking this will work (please let me know if you disagree on these points):getHeaderMessage
takes only a few parameters, and all of the params should be able to be calculated from other variables insidegetOptions
getOptions
is only used inOptionsListUtils
, which hasget...Options
functions for specific pages, all of those pages will need this type of functionality (the same type of logic forheaderMessage
)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.
Hi @Beamanator
I tried merging these changes into utils. So
getSearchOptions
&getHeaderMessage
are independent of each other. They both take thesearchValue
as one of the input. With this, we might end up hitting the phone number validation API twice.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.
Hmm once you push your latest changes I can check and see if I can help come up with a way to only hit that validation API once 👍
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.
I believe
^[0-9]*$
matches even an empty string, is that known / desired? Can you combine these two into the same expression?I also believe
\d
is the same as[0-9]
so if you can't combine them, at least we can be consistent with\d
or[0-9]
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.
Also this doesn't correctly check if a typed phone number already has a
+
in front. I believe we can useStr.isValidPhone
instead of coming up with a new regexp here right?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.
I tried using
Str.isValidPhone
but it is not working properly. Also I am using||
so that if any of the regex matches then it skips the checks for second one. Combining them is possible but will increase the time complexity of the program.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.
As mentioned above, let's do something like
headerMessage: translate(preferredLocale, 'messages.noPhoneNumber')
hereThere 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.
Please delete if you're not using anymore