-
Notifications
You must be signed in to change notification settings - Fork 25
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
Handle leading/trailing spaces in search input #248
Conversation
We could only change the value send in the request, but I would actually move this all the way up and make the server decide. It would be here: wca-live/lib/wca_live/competitions.ex Lines 39 to 41 in 5f546f5
You can add filter = filter |> String.trim() |> String.replace(~r/\s+/, " ") and then we can expand this test: wca-live/test/wca_live/competitions_test.exs Lines 21 to 31 in 5f546f5
|
That would be nice, but I've tried trimming the name on the backend (and changing the value only for the request), and it won't actually work because the |
We can skip the default filterOptions={(options, state) => options} |
This is exactly what I was looking for but couldn’t find, thanks! |
Thanks! |
It's very annoying when you paste a competition name that accidentally has a space before the actual name, causing the search to fail. The same issue occurs if there are, for example, two spaces between words.
After these changes, it's no longer possible to start a search with a space or type multiple consecutive spaces. I couldn't find a better solution to this, if anyone has suggestions feel free to comment on this PR.