diff --git a/client/src/components/Settings/FiltersConfig/Form.js b/client/src/components/Settings/FiltersConfig/Form.js index 9863d810..d08196bf 100644 --- a/client/src/components/Settings/FiltersConfig/Form.js +++ b/client/src/components/Settings/FiltersConfig/Form.js @@ -61,7 +61,6 @@ const Form = (props) => { - {getIntervalSelect(processing, t, handleChange, toNumber)} diff --git a/client/src/components/Settings/FiltersConfig/index.js b/client/src/components/Settings/FiltersConfig/index.js index c19fe24e..65e82ccf 100644 --- a/client/src/components/Settings/FiltersConfig/index.js +++ b/client/src/components/Settings/FiltersConfig/index.js @@ -1,33 +1,35 @@ -import React, { Component } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import { withTranslation } from 'react-i18next'; import debounce from 'lodash/debounce'; import { DEBOUNCE_TIMEOUT } from '../../../helpers/constants'; import Form from './Form'; +import { getObjDiff } from '../../../helpers/helpers'; -class FiltersConfig extends Component { - handleFormChange = debounce((values) => { - this.props.setFiltersConfig(values); +const FiltersConfig = (props) => { + const { initialValues, processing } = props; + + const handleFormChange = debounce((values) => { + const diff = getObjDiff(initialValues, values); + + if (Object.values(diff).length > 0) { + props.setFiltersConfig(values); + } }, DEBOUNCE_TIMEOUT); - render() { - const { interval, enabled, processing } = this.props; - - return ( -
- ); - } -} + return ( + + ); +}; FiltersConfig.propTypes = { - interval: PropTypes.number.isRequired, - enabled: PropTypes.bool.isRequired, + initialValues: PropTypes.object.isRequired, processing: PropTypes.bool.isRequired, setFiltersConfig: PropTypes.func.isRequired, t: PropTypes.func.isRequired, diff --git a/client/src/components/Settings/index.js b/client/src/components/Settings/index.js index c3e08584..66cff317 100644 --- a/client/src/components/Settings/index.js +++ b/client/src/components/Settings/index.js @@ -92,8 +92,10 @@ class Settings extends Component {