From d9f3acf7298c1cd39c980b9d6743624e18cdd8bf Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Wed, 3 Jul 2024 17:55:18 +0200 Subject: [PATCH] clear query log filter fix --- client/src/components/Logs/Filters/Form.tsx | 14 ++++++-------- client/src/components/Logs/Filters/index.tsx | 9 ++------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/client/src/components/Logs/Filters/Form.tsx b/client/src/components/Logs/Filters/Form.tsx index 65bbfcf0..f1b5b7be 100644 --- a/client/src/components/Logs/Filters/Form.tsx +++ b/client/src/components/Logs/Filters/Form.tsx @@ -1,6 +1,6 @@ import React, { useEffect } from 'react'; -import { Field, reduxForm } from 'redux-form'; +import { Field, type InjectedFormProps, reduxForm } from 'redux-form'; import { useTranslation } from 'react-i18next'; import { shallowEqual, useDispatch, useSelector } from 'react-redux'; @@ -104,14 +104,13 @@ const FORM_NAMES = { response_status: 'response_status', }; -interface FiltersFormProps { +type FiltersFormProps = { className?: string; responseStatusClass?: string; - change: (...args: unknown[]) => unknown; - setIsLoading?: (...args: unknown[]) => unknown; -} + setIsLoading: (...args: unknown[]) => unknown; +}; -const Form = (props: FiltersFormProps) => { +const Form = (props: FiltersFormProps & InjectedFormProps) => { const { className = '', responseStatusClass, setIsLoading, change } = props; const { t } = useTranslation(); @@ -142,7 +141,6 @@ const Form = (props: FiltersFormProps) => { const onInputClear = async () => { setIsLoading(true); - change(FORM_NAMES.search, DEFAULT_LOGS_FILTER[FORM_NAMES.search]); setIsLoading(false); }; @@ -195,7 +193,7 @@ const Form = (props: FiltersFormProps) => { ); }; -export default reduxForm({ +export const FiltersForm = reduxForm, FiltersFormProps>({ form: FORM_NAME.LOGS_FILTER, enableReinitialize: true, })(Form); diff --git a/client/src/components/Logs/Filters/index.tsx b/client/src/components/Logs/Filters/index.tsx index 9390c531..dfdbf3ec 100644 --- a/client/src/components/Logs/Filters/index.tsx +++ b/client/src/components/Logs/Filters/index.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch } from 'react-redux'; -import Form from './Form'; +import { FiltersForm } from './Form'; import { refreshFilteredLogs } from '../../../actions/queryLogs'; import { addSuccessToast } from '../../../actions/toasts'; @@ -38,12 +38,7 @@ const Filters = ({ filter, setIsLoading }: FiltersProps) => { - -
+ ); };