Skip to content

Commit

Permalink
Removing MultiselectOption, and simplifying code.
Browse files Browse the repository at this point in the history
  • Loading branch information
erinesullivan committed Oct 15, 2024
1 parent b74e284 commit 65180e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
7 changes: 2 additions & 5 deletions src/modules/advanced/components/FiltersContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ import { setAdvancedFilter } from '../../../advanced';

const FiltersContainer = ({ datastoreUid }) => {
const dispatch = useDispatch();
const filterGroups = useSelector((state) => {
return state.advanced[datastoreUid]?.filters;
});
const activeFilters = useSelector((state) => {
return state.advanced[datastoreUid]?.activeFilters;
const { activeFilters, filters: filterGroups } = useSelector((state) => {
return state.advanced[datastoreUid] || {};
});
const filters = getFilters({ activeFilters, filterGroups });

Expand Down
20 changes: 3 additions & 17 deletions src/modules/core/components/Multiselect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ const Multiselect = ({ descriptionText, filterGroupUid, handleSelection, options
if (!showOnlySelectedOptions || (showOnlySelectedOptions && option.checked)) {
return (
<li className='multiselect-options-list-item' key={index}>
<MultiselectOption
<Checkbox
isChecked={option.checked}
label={option.name}
handleClick={() => {
return handleOptionSelection(option, index);
}}
option={option}
/>
</li>
);
Expand Down Expand Up @@ -95,18 +96,3 @@ Multiselect.propTypes = {
};

export default Multiselect;

const MultiselectOption = ({ option, handleClick }) => {
return (
<Checkbox
isChecked={option.checked}
label={option.name}
handleClick={handleClick}
/>
);
};

MultiselectOption.propTypes = {
handleClick: PropTypes.func,
option: PropTypes.object
};

0 comments on commit 65180e0

Please sign in to comment.