- client: 2144 Fix DNS allowlists tab crash after opening "Choose blocklists" modal

Close #2144

Squashed commit of the following:

commit 435f17df9ce41e0f56b78cf8b7a390b73f16243b
Merge: 8899d65e 69a74071
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri Oct 2 13:02:36 2020 +0300

    Merge branch 'master' into fix/2144

commit 8899d65e9cf320fa07561f1f5a35cd3424a49a32
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Thu Oct 1 23:00:06 2020 +0300

    - client: 2144 Fix DNS allowlists tab crash after opening "Choose blocklists" modal
This commit is contained in:
Artem Baskal 2020-10-02 13:30:19 +03:00
parent 69a740714f
commit a7d2dd7bdb
4 changed files with 5 additions and 4 deletions

View File

@ -23,7 +23,7 @@ class DnsBlocklist extends Component {
} }
handleSubmit = (values, _, { initialValues }) => { handleSubmit = (values, _, { initialValues }) => {
const { filtering: { modalFilterUrl, modalType } } = this.props; const { modalFilterUrl, modalType } = this.props.filtering;
switch (modalType) { switch (modalType) {
case MODAL_TYPE.EDIT_FILTERS: case MODAL_TYPE.EDIT_FILTERS:

View File

@ -8,6 +8,8 @@ import { validatePath, validateRequiredValue } from '../../helpers/validators';
import { renderCheckboxField, renderInputField } from '../../helpers/form'; import { renderCheckboxField, renderInputField } from '../../helpers/form';
import { MODAL_OPEN_TIMEOUT, MODAL_TYPE, FORM_NAME } from '../../helpers/constants'; import { MODAL_OPEN_TIMEOUT, MODAL_TYPE, FORM_NAME } from '../../helpers/constants';
const filtersCatalog = require('../../helpers/filters/filters.json');
const getIconsData = (homepage, source) => ([ const getIconsData = (homepage, source) => ([
{ {
iconName: 'dashboard', iconName: 'dashboard',
@ -82,7 +84,6 @@ const Form = (props) => {
modalType, modalType,
toggleFilteringModal, toggleFilteringModal,
selectedSources, selectedSources,
filtersCatalog,
} = props; } = props;
const openModal = (modalType, timeout = MODAL_OPEN_TIMEOUT) => { const openModal = (modalType, timeout = MODAL_OPEN_TIMEOUT) => {
@ -168,7 +169,6 @@ Form.propTypes = {
whitelist: PropTypes.bool, whitelist: PropTypes.bool,
modalType: PropTypes.string.isRequired, modalType: PropTypes.string.isRequired,
toggleFilteringModal: PropTypes.func.isRequired, toggleFilteringModal: PropTypes.func.isRequired,
filtersCatalog: PropTypes.object,
selectedSources: PropTypes.object, selectedSources: PropTypes.object,
}; };

View File

@ -78,6 +78,7 @@ class Modal extends Component {
break; break;
} }
default: default:
break;
} }
const title = t(getTitle(modalType, whitelist)); const title = t(getTitle(modalType, whitelist));
@ -99,7 +100,6 @@ class Modal extends Component {
<Form <Form
selectedSources={selectedSources} selectedSources={selectedSources}
initialValues={initialValues} initialValues={initialValues}
filtersCatalog={filtersCatalog}
modalType={modalType} modalType={modalType}
onSubmit={handleSubmit} onSubmit={handleSubmit}
processingAddFilter={processingAddFilter} processingAddFilter={processingAddFilter}

View File

@ -56,6 +56,7 @@ const filtering = handleActions(
...state, ...state,
isModalOpen: !state.isModalOpen, isModalOpen: !state.isModalOpen,
isFilterAdded: false, isFilterAdded: false,
modalType: '',
}; };
return newState; return newState;
}, },