[Security solution][endpoint] Fix Endpoint List KQL bar not updating the list when the filter is removed (#112595)

* Fix search bar `onQuerySubmit` to drop prior `admin_query` param when pushing a new route change
* enhance current test case to ensure existing data is also changed when its blank
This commit is contained in:
Paul Tavares 2021-09-21 11:24:25 -04:00 committed by GitHub
parent 9bd61a21fe
commit 2e56351096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -92,7 +92,7 @@ describe('when rendering the endpoint list `AdminSearchBar`', () => {
])(
'should update the url and exclude the `admin_query` param when %s was entered',
async (_, value) => {
await render();
await render({ admin_query: "(language:kuery,query:'foo')" });
await submitQuery(value);
expect(getQueryParamsFromStore().admin_query).toBe(undefined);

View file

@ -24,7 +24,7 @@ const AdminQueryBar = styled.div`
export const AdminSearchBar = memo(() => {
const history = useHistory();
const queryParams = useEndpointSelector(selectors.uiQueryParams);
const { admin_query: _, ...queryParams } = useEndpointSelector(selectors.uiQueryParams);
const searchBarIndexPatterns = useEndpointSelector(selectors.patterns);
const searchBarQuery = useEndpointSelector(selectors.searchBarQuery);
const clonedIndexPatterns = useMemo(