Skip to content

Commit

Permalink
Send solr request only once [#19] (#20)
Browse files Browse the repository at this point in the history
The solr request to the backend is sent 2 times. This fixes it and
only 1 is sent.

By the way, this triggered a bug in asyncconnect. There was a race
condition and sometimes the results will be ignored completely, that is
both of the two updates were ignored.

It's beyond the scope to fix asyncconnect, but sending only 1 request
instead of the double should fix this.

Co-authored-by: Balázs Reé <ree@greenfinity.hu>
  • Loading branch information
reekitconcept and reebalazs authored Mar 6, 2024
1 parent a1ff5a2 commit 555e16f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/19.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Send solr request only once [#25] @reebalazs
5 changes: 3 additions & 2 deletions src/components/theme/SolrSearch/SolrSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,16 @@ class SolrSearch extends Component {
};

updateSearch = () => {
this.doSearch(this.searchParams());
this.props.history.replace({
search: qs.stringify(queryStateToParams(this.state)),
});
};

handleQueryPaginationChange = (e, { activePage }) => {
window.scrollTo(0, 0);
this.setState({ currentPage: activePage }, () => this.updateSearch());
this.setState({ currentPage: activePage }, () =>
this.doSearch(this.searchParams()),
);
};

onSortChange = (selectedOption, selectedSortOrder) => {
Expand Down

0 comments on commit 555e16f

Please sign in to comment.