Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Commit 928143d

Browse files
authored
Merge branch 'master' into settings-right
2 parents d8729a6 + c45f157 commit 928143d

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/containers/Search/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class Search extends Component {
2929
currentPage: PropTypes.number,
3030
perPage: PropTypes.number,
3131
query: PropTypes.string,
32-
results: PropTypes.arrayOf(verseType), // eslint-disable-line
32+
results: PropTypes.arrayOf(PropTypes.string),
33+
entities: PropTypes.arrayOf(verseType),
3334
push: PropTypes.func.isRequired,
3435
location: PropTypes.shape({ // eslint-disable-line
3536
q: PropTypes.string,
@@ -119,9 +120,9 @@ class Search extends Component {
119120
}
120121

121122
renderBody() {
122-
const { isErrored, isLoading, results, options, query } = this.props;
123+
const { isErrored, isLoading, results, entities, options, location: { query } } = this.props;
123124

124-
if (!query) {
125+
if (!query || !query.q) {
125126
return (
126127
<h3 className="text-center" style={{ padding: '15%' }}>
127128
<LocaleFormattedMessage id="search.nothing" defaultMessage="No search query." />
@@ -151,9 +152,9 @@ class Search extends Component {
151152

152153
return results.map(result => (
153154
<Verse
154-
verse={result}
155-
match={result.match}
156-
key={result.verseKey}
155+
verse={entities[result]}
156+
match={entities[result].match}
157+
key={entities[result].verseKey}
157158
tooltip={options.tooltip}
158159
isSearched
159160
/>
@@ -208,6 +209,7 @@ function mapStateToProps(state) {
208209
took: state.searchResults.took,
209210
query: state.searchResults.query,
210211
results: state.searchResults.results,
212+
entities: state.searchResults.entities,
211213
options: state.options
212214
};
213215
}

src/redux/modules/searchResults.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export default function reducer(state = initialState, action = {}) {
3232
perPage: action.result.result.perPage,
3333
took: action.result.result.took,
3434
query: action.result.result.query,
35-
results: action.result.result.results
35+
results: action.result.result.results,
36+
entities: action.result.entities.verses
3637
};
3738
case SEARCH_FAIL:
3839
return {

0 commit comments

Comments
 (0)