-
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
Fix suggestions dropdown for query input #80990
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
indexPatterns: [...objectPatterns, ...objectPatternsFromStrings], | ||
}); | ||
}; | ||
if (!this.fetchIndexPatternsAbortController.signal.aborted) { |
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 didn't test but, if I understood this correctly, this doesn't seem to be working as intended 🤔
Currently every time we are checking the LATEST abort controller, but we should instead check to the
abort controller which was created when we fired a corresponding fetch:
I think it should look something like this instead:
if (this.lastAbortController) this.lastAbortController.abort(); // make sure any older requests are canceled.
this.lastAbortController = new AbortController();
const currentAbortController = this.lastAbortController;
await fetch();
if (!currentAbortController.signal.aborted) {
//
this.setState()
this.updateSuggestions
}
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.
Thanks @Dosant , updated
0e8cd20
to
9ad9334
Compare
@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.
Code is LGTM, I can't replicate the bug always, but I managed to replicate it on master. I can't replicate it with the new changes so it seems fine to me 🙂
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]async chunks size
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.
Code LGTM, didn't test
* Fix suggestions * Increase timeout * Use abort controller * Update abort controller Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Fix suggestions * Increase timeout * Use abort controller * Update abort controller Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…arm-phase-to-formlib * 'master' of github.com:elastic/kibana: [Trigger Actions UI] Properly unmount app (elastic#81436) skip flaky suite (elastic#81576) skip flaky suite (elastic#78373) [Security Solution] Fix styling of EditDataProvider content (elastic#81456) [Search] Error Alignment 2 (elastic#80965) [APM] Unskip test (elastic#81574) [ML] Fix partition value selection on the Single Metric Viewer (elastic#81585) cleaning up expression service types (elastic#80643) Fix suggestions dropdown for query input (elastic#80990) [Usage collection] Make `schema` mandatory (elastic#79999) [ILM] Update show/hide data tier logic on cloud (elastic#81455) added brace import to advanced settings (elastic#81458) chore(NA): add spec-to-console and plugin-helpers as devOnly dependencies
Summary
Fixes #80831
Initial issue: When changing an index pattern in TSVB under panel options from the default one, the KQL autocompletion under "Panel filter" will still show the fields of the default index pattern until you switched away from the Panel Options tab and back to it (unmount - mount the filter component).
It seems the problem was in order of calling
updateSuggestions
method. Here are logs of asyncfetchIndexPatterns
calls:Steps:
kibana_sample_data_logs
index pattern;kibana_sample_data_log
and freezed untilfetchIndexPatterns
completed;kibana_sample_data_logs
- then the resolvedfetchIndexPatterns
immediately updates the suggestions - and then the first call takes precedence and overrides the suggestions valueThe fix bring in the
AbortController
to abort the previousfetchIndexPatterns
.Also, the
debounce
was added to reduce the amount of calls.Checklist
Delete any items that are not applicable to this PR.
For maintainers