From 5f6bb4a0f8135f9e53bbc49b85ad224e4d09c64f Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Wed, 16 Nov 2022 16:25:19 -0500 Subject: [PATCH] Clear/remove filter works --- .../src/components/ProcessInstanceListTable.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx index 8f482a59..b77f4fba 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx @@ -225,6 +225,7 @@ export default function ProcessInstanceListTable({ // @ts-expect-error TS(7053) FIXME: const functionToCall = parametersToAlwaysFilterBy[paramName]; const paramValue = filters[paramName]; + functionToCall(''); if (paramValue) { const dateString = convertSecondsToFormattedDate(paramValue as any); functionToCall(dateString); @@ -234,20 +235,19 @@ export default function ProcessInstanceListTable({ Object.keys(parametersToGetFromSearchParams).forEach( (paramName: string) => { - if ( - paramName === 'process_model_identifier' && - typeof filters.process_model_identifier === 'string' - ) { + if (paramName === 'process_model_identifier') { + setProcessModelSelection(null); processModelAvailableItems.forEach((item: any) => { if (item.id === filters.process_model_identifier) { setProcessModelSelection(item); } }); - } else if ( - paramName === 'process_status' && - typeof filters.process_status === 'string' - ) { + } else if (paramName === 'process_status') { const processStatusSelectedArray: string[] = []; + setProcessStatusSelection(processStatusSelectedArray); + if (!filters.process_status) { + return; + } PROCESS_STATUSES.forEach((processStatusOption: any) => { const regex = new RegExp(`\\b${processStatusOption}\\b`); if (filters.process_status.match(regex)) {