-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Discover] Fix double fetching of saved search embeddable #84060
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 double fetching of saved search embeddable #84060
Conversation
|
Pinging @elastic/kibana-app (Team:KibanaApp) |
|
@elasticmachine merge upstream |
…mbeddable-redundant-fetch
💛 Build succeeded, but was flaky
Test FailuresX-Pack Alerting API Integration Tests.x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy·ts.alerting api integration security and spaces enabled Alerts alerts "before all" hook in "alerts"Standard OutStack TraceX-Pack Alerting API Integration Tests.x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy·ts.alerting api integration security and spaces enabled Alerts alerts "after all" hook in "alerts"Standard OutStack TraceX-Pack Alerting API Integration Tests.x-pack/test/alerting_api_integration/security_and_spaces/tests/index·ts.alerting api integration security and spaces enabled "after all" hook in "alerting api integration security and spaces enabled"Standard OutStack TraceMetrics [docs]
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.
Tested in Chrome, works as expected, LGTM
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
3 similar comments
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Summary
On a dashboard a saved search submitted 2 requests when timerange, filter or query was changed. This happened because
prevFilters,prevQuery,prevTimeRangewere set after thefetchfunction was executedkibana/src/plugins/discover/public/application/embeddable/search_embeddable.ts
Lines 339 to 343 in 282c44c
The fetch function was adapted in #68623 to set the loading state:
kibana/src/plugins/discover/public/application/embeddable/search_embeddable.ts
Line 300 in 282c44c
Because of this
pushContainerStateParamsToScopewas executed again,isFetchRequiredreturnedtrue, sinceprevFilters,prevQuery,prevTimeRangewere not updated.kibana/src/plugins/discover/public/application/embeddable/search_embeddable.ts
Lines 320 to 325 in 282c44c
And this was the reason for the 2nd request of data.
This PR fixes this race condition by setting the previous values:
before the execution of
fetch, soisFetchRequiredreturns false, no more double request.Fixes #82110
Checklist
Delete any items that are not applicable to this PR.
- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] Unit or functional tests were updated or added to match the most common scenarios- [ ] Any UI touched in this PR is usable by keyboard only (learn more about keyboard accessibility)- [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this in your browser)- [ ] This was checked for cross-browser compatibilityFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately