diff --git a/packages/common-ui/lib/list-page/query-builder/QueryBuilder.tsx b/packages/common-ui/lib/list-page/query-builder/QueryBuilder.tsx index 2fb8461387..c7a52fe10c 100644 --- a/packages/common-ui/lib/list-page/query-builder/QueryBuilder.tsx +++ b/packages/common-ui/lib/list-page/query-builder/QueryBuilder.tsx @@ -106,6 +106,7 @@ function QueryBuilder({ queryBuilderConfig={queryBuilderConfig} setSubmittedQueryBuilderTree={setSubmittedQueryBuilderTree} setPageOffset={setPageOffset} + performSubmit={onSubmit} /> >; + + /** + * For the last loaded search, we will actually perform the search by calling this callback + * function. + */ + performSubmit: () => void; } interface UseLastSavedSearchReturn { @@ -37,7 +43,8 @@ export function useLastSavedSearch({ indexName, setQueryBuilderTree, setSubmittedQueryBuilderTree, - setPageOffset + setPageOffset, + performSubmit }: UseLastSavedSearchProps): UseLastSavedSearchReturn { const localStorageLastUsedTreeKey = indexName + "-last-used-tree"; @@ -68,6 +75,8 @@ export function useLastSavedSearch({ Utils.loadTree(localStorageQueryTree as JsonTree) ); setPageOffset(0); + } else { + performSubmit(); } }, [queryLoaded]); diff --git a/packages/common-ui/lib/list-page/saved-searches/SavedSearch.tsx b/packages/common-ui/lib/list-page/saved-searches/SavedSearch.tsx index 253827bd38..dfaee1dc62 100644 --- a/packages/common-ui/lib/list-page/saved-searches/SavedSearch.tsx +++ b/packages/common-ui/lib/list-page/saved-searches/SavedSearch.tsx @@ -54,6 +54,12 @@ export interface SavedSearchProps { * Set the page offset, used to to load a saved search. */ setPageOffset: React.Dispatch>; + + /** + * For the last loaded search, we will actually perform the search by calling this callback + * function. + */ + performSubmit: () => void; } /** @@ -75,7 +81,8 @@ export function SavedSearch({ setQueryBuilderTree, queryBuilderConfig, setSubmittedQueryBuilderTree, - setPageOffset + setPageOffset, + performSubmit }: SavedSearchProps) { const { save, apiClient } = useApiClient(); const { openModal } = useModal(); @@ -109,7 +116,8 @@ export function SavedSearch({ indexName, setQueryBuilderTree, setSubmittedQueryBuilderTree, - setPageOffset + setPageOffset, + performSubmit }); // Using the user preferences get the options and user preferences.