Skip to content

Commit

Permalink
Sync query and filter when refreshing discover page (#8168)
Browse files Browse the repository at this point in the history
* revert back to use savedSearch

Signed-off-by: abbyhu2000 <[email protected]>

* change to use savedSearchId

Signed-off-by: abbyhu2000 <[email protected]>

* Changeset file for PR #8168 created/updated

* revert to use savesearch

Signed-off-by: abbyhu2000 <[email protected]>

---------

Signed-off-by: abbyhu2000 <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
1 parent ceff8b5 commit 18875f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8168.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Sync query and filter when refreshing discover page ([#8168](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8168))
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ export const useSearch = (services: DiscoverViewServices) => {
const savedSearchInstance = await getSavedSearchById(savedSearchId);
setSavedSearch(savedSearchInstance);

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

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

0 comments on commit 18875f7

Please sign in to comment.