fix: fixed searchbar crashing #240
Merged
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.
Description
The SearchBar, does not take a default prop buildUID, which means that for example here https://github.com/inveniosoftware/invenio-communities/blob/8ff51b31e1a5cb1e9f3f0568e6a405447b8f9aba/invenio_communities/assets/semantic-ui/js/invenio_communities/community/searchComponents/CommunitiesSearchLayout.js#L38 (maybe in other places where it was forgotten to pass buildUID function to SearchBar), the app crashes. Meaning the community home page /communities//records crashes.
It happens because if this conditional fails, the components proceeds and tries to call buildUID
invenio-search-ui/invenio_search_ui/assets/semantic-ui/js/invenio_search_ui/components/SearchBar.js
Lines 16 to 20 in c0f7265
We received a design of a repository that does not have searchbar in the header as there is in RDM implementation, so this is how we discovered this bug. It seems reasonable that there would be default value for buildUID function passed to the component. Please let us know if we could merge this. Thanks!