Skip to content

Commit

Permalink
revert to use savesearch
Browse files Browse the repository at this point in the history
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
  • Loading branch information
abbyhu2000 committed Sep 13, 2024
1 parent 45b7ed6 commit 88fb745
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,14 @@ export const useSearch = (services: DiscoverViewServices) => {
// Get savedSearch if it exists
useEffect(() => {
(async () => {
const savedSearchInstance = await getSavedSearchById(savedSearchId);
setSavedSearch(savedSearchInstance);

// if saved search does not exist, do not atempt to sync filters and query from savedObject
if (!savedSearchId) {
if (!savedSearch) {
return;

Check warning on line 329 in src/plugins/discover/public/application/view_components/utils/use_search.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/view_components/utils/use_search.ts#L329

Added line #L329 was not covered by tests
}

const savedSearchInstance = await getSavedSearchById(savedSearchId);
setSavedSearch(savedSearchInstance);

// sync initial app filters from savedObject to filterManager
const filters = cloneDeep(savedSearchInstance.searchSource.getOwnField('filter'));
const query =
Expand Down

0 comments on commit 88fb745

Please sign in to comment.