-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync query and filter when refreshing discover page #8168
Sync query and filter when refreshing discover page #8168
Conversation
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the linter will complain that this isn't included in the dependency if it wasn't disabled? however i noticed that 325 sets this value.
i can see in the future someone listening to the linter and including the savedsearch in the dependencies.
shouldn't we just do
if (!savedSearchInstance) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to use savedSearchId
instead since it is already a dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
savedSearchInstance does not work here because it is always defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
savedSearchId
here wont work as well, because when we create a new saved search, the id is null, but we do not want to return here.
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
ec40894
to
88fb745
Compare
Manual 2.17 backport : #8179 |
link check failure is not related: |
* revert back to use savedSearch Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com> * change to use savedSearchId Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com> * Changeset file for PR #8168 created/updated * revert to use savesearch Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com> --------- Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 18875f7) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Follow up PR of opensearch-project/OpenSearch-Dashboards#8168 to add test to make sure queries and filters are persisted across refresh, and switching between new and legacy tables. Signed-off-by: Qingyang(Abby) Hu <abigailhu2000@gmail.com>
Follow up PR of opensearch-project/OpenSearch-Dashboards#8168 to add test to make sure queries and filters are persisted across refresh, and switching between new and legacy tables. Signed-off-by: Qingyang(Abby) Hu <abigailhu2000@gmail.com> (cherry picked from commit fb85e41)
Follow up PR of opensearch-project/OpenSearch-Dashboards#8168 to add test to make sure queries and filters are persisted across refresh, and switching between new and legacy tables. Signed-off-by: Qingyang(Abby) Hu <abigailhu2000@gmail.com> (cherry picked from commit fb85e41) Co-authored-by: Qingyang(Abby) Hu <abigailhu2000@gmail.com>
This fix appears to have caused a very ugly bug where filters added on a dashboard or in the visualization editor then appear on the Discover page when you navigate there. What's more, the issues this pull request claims to fix appear to work fine without the change anyway. |
Description
This PR resolves previously identified three similar bugs when using legacy discover:
Query and filter failed to persist when:
Issues Resolved
Screenshot
Screen.Recording.2024-09-12.at.1.28.21.PM.mov
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration