fix(admin-panel): trim whitespace from admin panel search bar #12706
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.
Because:
This pull request:
Trims the search input value before we submit it to the search (in the
handleSubmit
action, in the input length check that determines whether or not to show suggestions, and also in the search that returns suggested matching emails.) There is a slightly simpler way to this -- we could just trim"event.target.value" before it's set into state using
setSearchInput
, but this could result in the user trying to typein the input (with spaces, for example) and thinking they couldn't interact with the search input (since the value of the search input would be constantly trimmed). While slightly more complicated, I think this is a safer solution.
There also seemed to be a duplicate
setSearchInput
action happening inonTextChanged
, which I have removed.onTextChanged
seems to only ever be called byhandleChange
, which already callssetSearchInput
.Closes #12567
Checklist
Put an
x
in the boxes that applyScreenshots
Before (whitespace before or after search input value is included in query term and returns nothing):
After (whitespace is trimmed and search returns correct record):