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,31 +333,31 @@ function AllErrors(): JSX.Element {
}, },
]; ];
const onChangeHandler: TableProps<Exception>['onChange'] = ( const onChangeHandler: TableProps<Exception>['onChange'] = useCallback(
paginations, (paginations, filters, sorter) => {
filters, if (!Array.isArray(sorter)) {
sorter, const { pageSize = 0, current = 0 } = paginations;
) => { const { columnKey = '', order } = sorter;
if (!Array.isArray(sorter)) { const updatedOrder = order === 'ascend' ? 'ascending' : 'descending';
const { pageSize = 0, current = 0 } = paginations; const params = new URLSearchParams(window.location.search);
const { columnKey = '', order } = sorter; const { exceptionType, serviceName } = extractFilterValues(filters, {
const updatedOrder = order === 'ascend' ? 'ascending' : 'descending'; serviceName: getFilterString(params.get(urlKey.serviceName)),
const { exceptionType, serviceName } = extractFilterValues(filters, { exceptionType: getFilterString(params.get(urlKey.exceptionType)),
serviceName: getUpdatedServiceName, });
exceptionType: getUpdatedExceptionType, history.replace(
}); `${pathname}?${createQueryParams({
history.replace( order: updatedOrder,
`${pathname}?${createQueryParams({ offset: (current - 1) * pageSize,
order: updatedOrder, orderParam: columnKey,
offset: (current - 1) * pageSize, pageSize,
orderParam: columnKey, exceptionType,
pageSize, serviceName,
exceptionType, })}`,
serviceName, );
})}`, }
); },
} [pathname],
}; );
return ( return (
<Table <Table