mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-10-26 11:27:18 +00:00
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:
parent
2f32b97d2f
commit
403fa9b1fe
@ -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);
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user