From 403fa9b1fe27e779cba57f5617b10978b8b8f36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=F0=9F=90=A7=20Lobanov?= Date: Wed, 19 Mar 2025 16:42:51 +0300 Subject: [PATCH] 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 Date: Wed Mar 19 13:41:16 2025 +0100 fixed search field and get parameters sync in logs --- client/src/components/Logs/Filters/Form.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/src/components/Logs/Filters/Form.tsx b/client/src/components/Logs/Filters/Form.tsx index 3714f308..e1119920 100644 --- a/client/src/components/Logs/Filters/Form.tsx +++ b/client/src/components/Logs/Filters/Form.tsx @@ -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); };