-
Notifications
You must be signed in to change notification settings - Fork 894
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
[Discover] Fix discover query loading state #8832
[Discover] Fix discover query loading state #8832
Conversation
Signed-off-by: Joshua Li <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8832 +/- ##
=======================================
Coverage 60.86% 60.87%
=======================================
Files 3799 3799
Lines 90761 90757 -4
Branches 14294 14291 -3
=======================================
+ Hits 55246 55248 +2
+ Misses 32005 32000 -5
+ Partials 3510 3509 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Joshua Li <[email protected]>
e100f36
to
3c1a512
Compare
@@ -155,7 +155,7 @@ export const useSearch = (services: DiscoverViewServices) => { | |||
.getUpdates$() | |||
.pipe( | |||
pairwise(), | |||
filter(([prev, curr]) => prev.dataset?.id === curr.dataset?.id) | |||
filter(([prev, curr]) => prev.dataset?.id !== curr.dataset?.id) |
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.
Why do we change this logic here? @joshuali925
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.
the logic was accidentally reversed due to testing, we want to reset data$
to initial state when two datasets are different (meaning user changed dataset), not when they are the same
if (fetchStateRef.current.rows?.length === 0) { | ||
data$.next({ status: ResultStatus.LOADING, queryStatus: { startTime } }); | ||
} | ||
data$.next({ status: ResultStatus.LOADING, queryStatus: { startTime: currentTime } }); |
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.
So we wish to always to show loading indicator no matter if the rows are empty or not?
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.
yes
)} | ||
{fetchState.status === ResultStatus.LOADING && !rows?.length && <LoadingSpinner />} | ||
{(fetchState.status === ResultStatus.READY || | ||
(fetchState.status === ResultStatus.LOADING && !!rows?.length)) && |
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.
why do we have two different result for loading status now?
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.
we want to show results if query finished and results are ready, or if there are previous results while current query is loading
* [Discover] Fix loading status when uninitialized Signed-off-by: Joshua Li <[email protected]> * fix discover loading state Signed-off-by: Joshua Li <[email protected]> --------- Signed-off-by: Joshua Li <[email protected]> (cherry picked from commit c20c041) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* [Discover] Fix loading status when uninitialized * fix discover loading state --------- (cherry picked from commit c20c041) Signed-off-by: Joshua Li <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Duplicated code was introduced by #8565 to run the same logic regardless of
if
condition, possibly due to merge conflict?OpenSearch-Dashboards/src/plugins/data/public/query/query_string/language_service/lib/query_result.tsx
Lines 62 to 94 in c8278f3
It causes UI to show loading even when status is not loading. This PR fixes it
Additionally, this PR changes loading behavior to be
Issues Resolved
Screenshot
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration