fix: exception filter clear (#1936)

This commit is contained in:
Vishal Sharma 2022-12-28 17:48:39 +05:30 committed by GitHub
parent d1ee15c372
commit 46e131698e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,10 +138,10 @@ function AllErrors(): JSX.Element {
filterKey: string, filterKey: string,
): VoidFunction => (): void => { ): VoidFunction => (): void => {
const { exceptionFilterValue, serviceFilterValue } = getFilterValues( const { exceptionFilterValue, serviceFilterValue } = getFilterValues(
getUpdatedServiceName, getUpdatedServiceName || '',
getUpdatedExceptionType, getUpdatedExceptionType || '',
filterKey, filterKey,
filterValue, filterValue || '',
); );
history.replace( history.replace(
`${pathname}?${createQueryParams({ `${pathname}?${createQueryParams({
@ -333,18 +333,16 @@ function AllErrors(): JSX.Element {
}, },
]; ];
const onChangeHandler: TableProps<Exception>['onChange'] = ( const onChangeHandler: TableProps<Exception>['onChange'] = useCallback(
paginations, (paginations, filters, sorter) => {
filters,
sorter,
) => {
if (!Array.isArray(sorter)) { if (!Array.isArray(sorter)) {
const { pageSize = 0, current = 0 } = paginations; const { pageSize = 0, current = 0 } = paginations;
const { columnKey = '', order } = sorter; const { columnKey = '', order } = sorter;
const updatedOrder = order === 'ascend' ? 'ascending' : 'descending'; const updatedOrder = order === 'ascend' ? 'ascending' : 'descending';
const params = new URLSearchParams(window.location.search);
const { exceptionType, serviceName } = extractFilterValues(filters, { const { exceptionType, serviceName } = extractFilterValues(filters, {
serviceName: getUpdatedServiceName, serviceName: getFilterString(params.get(urlKey.serviceName)),
exceptionType: getUpdatedExceptionType, exceptionType: getFilterString(params.get(urlKey.exceptionType)),
}); });
history.replace( history.replace(
`${pathname}?${createQueryParams({ `${pathname}?${createQueryParams({
@ -357,7 +355,9 @@ function AllErrors(): JSX.Element {
})}`, })}`,
); );
} }
}; },
[pathname],
);
return ( return (
<Table <Table