Skip to content
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

Merged

Conversation

abbyhu2000
Copy link
Member

@abbyhu2000 abbyhu2000 commented Sep 12, 2024

Description

This PR resolves previously identified three similar bugs when using legacy discover:

Query and filter failed to persist when:

  • refresh the page
  • switching between default discover table and datagrid
  • using the share link

Issues Resolved

Screenshot

Screen.Recording.2024-09-12.at.1.28.21.PM.mov

Testing the changes

Changelog

  • fix: Sync query and filter when refreshing discover page

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

kavilla
kavilla previously approved these changes Sep 12, 2024
@@ -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) {
Copy link
Member

@kavilla kavilla Sep 12, 2024

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) {

Copy link
Member Author

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

Copy link
Member Author

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

Copy link
Member Author

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.

@abbyhu2000 abbyhu2000 dismissed stale reviews from kavilla and ashwin-pc via ec40894 September 12, 2024 22:44
kavilla
kavilla previously approved these changes Sep 12, 2024
sejli
sejli previously approved these changes Sep 12, 2024
abbyhu2000 and others added 4 commits September 13, 2024 00:05
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
@abbyhu2000 abbyhu2000 dismissed stale reviews from sejli and kavilla via 88fb745 September 13, 2024 00:12
@abbyhu2000 abbyhu2000 force-pushed the query_filter_fail_to_sync branch from ec40894 to 88fb745 Compare September 13, 2024 00:12
@abbyhu2000
Copy link
Member Author

Manual 2.17 backport : #8179

@abbyhu2000
Copy link
Member Author

link check failure is not related: * [404] [http://sites.google.com/site/murmurhash/](http://sites.google.com/site/murmurhash/) | Failed: Network error: Not Found

@abbyhu2000 abbyhu2000 merged commit 18875f7 into opensearch-project:main Sep 13, 2024
65 of 67 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 13, 2024
* 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>
kavilla pushed a commit to opensearch-project/opensearch-dashboards-functional-test that referenced this pull request Sep 26, 2024
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>
opensearch-trigger-bot bot pushed a commit to opensearch-project/opensearch-dashboards-functional-test that referenced this pull request Sep 26, 2024
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)
ashwin-pc pushed a commit to opensearch-project/opensearch-dashboards-functional-test that referenced this pull request Oct 1, 2024
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>
@neodescis
Copy link
Contributor

neodescis commented Nov 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants