diff --git a/client/src/components/Settings/Dns/Cache/Form.js b/client/src/components/Settings/Dns/Cache/Form.js index f17310c9..9a13ec63 100644 --- a/client/src/components/Settings/Dns/Cache/Form.js +++ b/client/src/components/Settings/Dns/Cache/Form.js @@ -4,16 +4,15 @@ import { Field, reduxForm } from 'redux-form'; import { Trans, useTranslation } from 'react-i18next'; import { shallowEqual, useSelector } from 'react-redux'; import { renderInputField, toNumber } from '../../../../helpers/form'; -import { validateRequiredValue } from '../../../../helpers/validators'; import { CACHE_CONFIG_FIELDS, FORM_NAME, UINT32_RANGE } from '../../../../helpers/constants'; +import { replaceZeroWithEmptyString } from '../../../../helpers/helpers'; -const getInputFields = (validateRequiredValue) => [ +const INPUTS_FIELDS = [ { name: CACHE_CONFIG_FIELDS.cache_size, title: 'cache_size', description: 'cache_size_desc', placeholder: 'enter_cache_size', - validate: validateRequiredValue, }, { name: CACHE_CONFIG_FIELDS.cache_ttl_min, @@ -39,37 +38,34 @@ const Form = ({ cache_ttl_max, cache_ttl_min, } = useSelector((state) => state.form[FORM_NAME.CACHE].values, shallowEqual); - const minExceedsMax = typeof cache_ttl_min === 'number' - && typeof cache_ttl_max === 'number' - && cache_ttl_min > cache_ttl_max; - - const INPUTS_FIELDS = getInputFields(validateRequiredValue); + const minExceedsMax = cache_ttl_min > cache_ttl_max; return