client: resync with master

This commit is contained in:
Eugene Burkov
2025-03-19 16:44:03 +03:00
parent e6b31bab77
commit 729c56de20

View File

@@ -6,6 +6,8 @@ import { useDispatch } from 'react-redux';
import { useHistory } from 'react-router-dom';
import classNames from 'classnames';
import { useFormContext } from 'react-hook-form';
import queryString from 'query-string';
import {
DEBOUNCE_FILTER_TIMEOUT,
DEFAULT_LOGS_FILTER,
@@ -54,9 +56,17 @@ export const Form = ({ className, setIsLoading }: Props) => {
}
}, [responseStatusValue, setValue]);
useEffect(() => {
const { search: searchUrlParam } = queryString.parse(history.location.search);
if (searchUrlParam !== searchValue) {
setValue('search', searchUrlParam ? searchUrlParam.toString() : '');
}
}, [history.location.search, setValue, searchValue]);
const onInputClear = async () => {
setIsLoading(true);
setValue('search', DEFAULT_LOGS_FILTER.search);
history.push(getLogsUrlParams(DEFAULT_LOGS_FILTER.search, responseStatusValue));
setIsLoading(false);
};