Skip to content

Commit

Permalink
Fix selecting guids from search results
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed Jul 21, 2023
1 parent 07cb19f commit ebe0191
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions frontend/src/Search/SearchIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@ import SearchFooterConnector from './SearchFooterConnector';
import SearchIndexTableConnector from './Table/SearchIndexTableConnector';
import styles from './SearchIndex.css';

function getViewComponent(isSmallScreen) {
if (isSmallScreen) {
return SearchIndexOverviewsConnector;
}

return SearchIndexTableConnector;
}
const getViewComponent = (isSmallScreen) => (isSmallScreen ? SearchIndexOverviewsConnector : SearchIndexTableConnector);

class SearchIndex extends Component {

Expand Down Expand Up @@ -78,7 +72,7 @@ class SearchIndex extends Component {

if (sortKey !== prevProps.sortKey ||
sortDirection !== prevProps.sortDirection ||
hasDifferentItemsOrOrder(prevProps.items, items)
hasDifferentItemsOrOrder(prevProps.items, items, 'guid')
) {
this.setJumpBarItems();
this.setSelectedState();
Expand All @@ -100,7 +94,14 @@ class SearchIndex extends Component {
if (this.state.allUnselected) {
return [];
}
return getSelectedIds(this.state.selectedState, { parseIds: false });

return _.reduce(this.state.selectedState, (result, value, id) => {
if (value) {
result.push(id);
}

return result;
}, []);
};

setSelectedState() {
Expand Down

0 comments on commit ebe0191

Please sign in to comment.