Pull request #2373: rc-v0.107.58-hotfix

Merge in DNS/adguard-home from rc-v0.107.58-hotfix to master

Squashed commit of the following:

commit 1837650f36fff704a4e1fa38c0c560f4e14a183d
Author: Igor Lobanov <bniwredyc@gmail.com>
Date:   Wed Mar 19 13:41:16 2025 +0100

    fixed search field and get parameters sync in logs
This commit is contained in:
Igor 🐧 Lobanov
2025-03-19 16:42:51 +03:00
parent 2f32b97d2f
commit 403fa9b1fe

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);
};