Ensure suggestions is an array and close autocomplete on search
When a search yields no suggestions the backend will produce a malformed response in the form {"": []} (given that the structure should be [{...result...}, ...]), which causes the front-end to choke. This cleans that up to ensure we always put an array into the redux store. Ideally this would be fixed on the back-end but ensuring an array on the front-end could also be a worth-while addition.
Also closes the autocomplete when a search is initiated as a small quality-of-life improvement to the search experience.
Checklist
[ ] Unit tests written
[x] Manually tested
[x] Prettier & ESLint were run
[ ] New dependencies are included in package-lock.json
Ensure suggestions is an array and close autocomplete on search
When a search yields no suggestions the backend will produce a malformed response in the form
{"": []}
(given that the structure should be[{...result...}, ...]
), which causes the front-end to choke. This cleans that up to ensure we always put an array into the redux store. Ideally this would be fixed on the back-end but ensuring an array on the front-end could also be a worth-while addition.Also closes the autocomplete when a search is initiated as a small quality-of-life improvement to the search experience.
Checklist
package-lock.json