-
Notifications
You must be signed in to change notification settings - Fork 867
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
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.
Can we add a test for this as a fast follow?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8168 +/- ##
==========================================
+ Coverage 64.03% 64.04% +0.01%
==========================================
Files 3740 3740
Lines 88580 88582 +2
Branches 13790 13791 +1
==========================================
+ Hits 56720 56732 +12
+ Misses 31262 31252 -10
Partials 598 598
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
is this correctly for 2.17? |
@@ -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>
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