Skip to content

fix: reset review opportunity filter #5127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
/* eslint-disable jsx-a11y/label-has-for */

import _ from 'lodash';
import { challenge as challengeUtils } from 'topcoder-react-lib';
import React from 'react';
import PT from 'prop-types';
import Select from 'components/Select';
Expand All @@ -38,7 +37,6 @@ import DateRangePicker from '../DateRangePicker';
import style from './style.scss';
import UiSimpleRemove from '../../Icons/ui-simple-remove.svg';

const Filter = challengeUtils.filter;

export default function FiltersPanel({
communityFilters,
Expand Down Expand Up @@ -328,9 +326,10 @@ export default function FiltersPanel({
autoBlur
clearable={false}
id="review-type-select"
onChange={
value => setFilterState(Filter.setReviewOpportunityType(filterState, value))
}
onChange={(value) => {
const reviewOpportunityType = value === 0 ? undefined : value;
setFilterState({ ..._.clone(filterState), reviewOpportunityType });
}}
options={[
{ label: 'All', value: 0 }, // 0 value deactivates above filter
...Object.entries(REVIEW_OPPORTUNITY_TYPES)
Expand Down Expand Up @@ -434,6 +433,7 @@ export default function FiltersPanel({
endDateStart: null,
startDateEnd: null,
status: 'All',
reviewOpportunityType: undefined,
});
selectCommunity(defaultCommunityId);
setSearchText('');
Expand Down