diff --git a/openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/useIncidentFilters.test.ts b/openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/useIncidentFilters.test.ts index d031535bd2bb..ac75c431fbb5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/useIncidentFilters.test.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/useIncidentFilters.test.ts @@ -247,6 +247,33 @@ describe('useIncidentFilters', () => { expect(firstCallArg.search).not.toContain('testCaseFQN'); }); + it('should drop the page and cursor params via clearAllFilters', () => { + const { result } = renderFiltersHook({ + allParams: { + testCaseFQN: 'svc.tbl.tc', + assignee: 'bob', + testCaseResolutionStatusType: 'Assigned', + startTs: '1', + endTs: '2', + dateField: 'updatedAt', + currentPage: '5', + cursorType: 'after', + cursorValue: 'foo', + other: 'z', + pageSize: '15', + }, + filters: { testCaseFQN: 'svc.tbl.tc' }, + }); + + act(() => { + result.current.clearAllFilters(); + }); + + const [firstCallArg] = mockNavigate.mock.calls[0]; + + expect(firstCallArg.search).toBe('other=z&pageSize=15'); + }); + it('should build 5 descriptors in the expected key/controlType order', () => { const { result } = renderFiltersHook(); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/useIncidentFilters.ts b/openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/useIncidentFilters.ts index f145ec339f1f..707fa84672cb 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/useIncidentFilters.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/useIncidentFilters.ts @@ -301,15 +301,25 @@ export const useIncidentFilters = ({ const clearAllFilters = useCallback(() => { setAssigneeOwnerRefs([]); - updateFilters({ - testCaseFQN: undefined, - testCaseResolutionStatusType: undefined, - assignee: undefined, - startTs: undefined, - endTs: undefined, - dateField: undefined, - }); - }, [updateFilters]); + navigate( + { + search: QueryString.stringify( + omit(allParams, [ + 'testCaseFQN', + 'testCaseResolutionStatusType', + 'assignee', + 'startTs', + 'endTs', + 'dateField', + 'currentPage', + 'cursorType', + 'cursorValue', + ]) + ), + }, + { replace: true } + ); + }, [allParams, navigate]); return { dateRangeKey,