-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Search service] Move loadingCount to sync search strategy #56335
Conversation
Pinging @elastic/kibana-app-arch (Team:AppArch) |
@elasticmachine merge upstream |
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.
Tested and working with both search
and msearch
.
Added a comment about sync strategy's implementation.
const search: ISearch<typeof SYNC_SEARCH_STRATEGY> = ( | ||
request: ISyncSearchRequest, | ||
options: ISearchOptions = {} | ||
) => { | ||
const loadingCount$ = new BehaviorSubject(0); | ||
context.core.http.addLoadingCountSource(loadingCount$); |
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.
You're going to keep adding an observable for every search.
I think we should just add it once and only trigger it for every search.
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.
Good call, resolved in e5d7d58.
💛 Build succeeded, but was flaky
History
To update your PR or re-run it, just comment with: |
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.
LGTM
…6335) * Move loadingCount to search strategy * Only register observable once Co-authored-by: Elastic Machine <[email protected]>
7.x (7.7.0): 7b0067f |
* master: (23 commits) Properly handle password change for users authenticated with provider other than `basic`. (elastic#55206) Improve pull request template proposal (elastic#56756) Only change handlers as the element changes (elastic#56782) [SIEM][Detection Engine] Final final rule changes (elastic#56806) [SIEM][Detection Engine] critical blocker, wrong ilm policy, need to match beats ilm policy Move ui/agg_types in to shim data plugin (elastic#56353) [SIEM] Fixes Signals count spinner (elastic#56797) [docs] Update upgrade version path (elastic#56658) [Canvas] Use unique Id for Canvas Embeddables (elastic#56783) [Rollups] Adjust max width for job detail panel (elastic#56674) Prevent http client from converting our form data (elastic#56772) Disable creating alerts client instances when ESO plugin is using an ephemeral encryption key (elastic#56676) Bumps terser-webpack-plugin to 2.3.4 (elastic#56662) Advanced settings component registry ⇒ kibana platform plugin (elastic#55940) [Endpoint] EMT-67: add kql support for endpoint list (elastic#56328) Implement UI for Create Alert form (elastic#55232) Fix: Filter pill base coloring (elastic#56761) fix open close signal on detail page (elastic#56757) [Search service] Move loadingCount to sync search strategy (elastic#56335) Rollup TSVB integration: Add test and fix warning text (elastic#56639) ...
Summary
This moves the handling of the
loadingCount$
from thecreateAppMountSearchContext
tosyncSearchStrategyProvider
.Since search strategies can be composed and call each other, it makes sense to leave it up to the individual strategy to properly handle
loadingCount$
. Since thesyncSearchStrategyProvider
is what actually makes the HTTP call, it makes sense to put it here.I ran into this when implementing the
asyncSearchStrategyProvider
, which in turn uses thesyncSearchStrategyProvider
. Since both were calling thesearch
method exposed bycreateAppMountSearchContext
, theloadingCount$
was being incremented/decremented incorrectly too many times, and never ended up clearing out.