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:
@@ -6,6 +6,8 @@ import { useDispatch } from 'react-redux';
|
|||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useFormContext } from 'react-hook-form';
|
import { useFormContext } from 'react-hook-form';
|
||||||
|
import queryString from 'query-string';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DEBOUNCE_FILTER_TIMEOUT,
|
DEBOUNCE_FILTER_TIMEOUT,
|
||||||
DEFAULT_LOGS_FILTER,
|
DEFAULT_LOGS_FILTER,
|
||||||
@@ -54,9 +56,17 @@ export const Form = ({ className, setIsLoading }: Props) => {
|
|||||||
}
|
}
|
||||||
}, [responseStatusValue, setValue]);
|
}, [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 () => {
|
const onInputClear = async () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
setValue('search', DEFAULT_LOGS_FILTER.search);
|
history.push(getLogsUrlParams(DEFAULT_LOGS_FILTER.search, responseStatusValue));
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user