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
Fixed async problem when checking for unknown fields #3937
Fixed async problem when checking for unknown fields #3937
Conversation
thought: I think we should change the flag to control that function is only executed one time, to a component instance variable instead of a state variable. Updating the state is an asynchronous method. suggestion: refreshKnownFields = async () => {
if (!this.hasRefreshedKnownFields) {
try {
this.hasRefreshedKnownFields = true;
this.isRefreshing = true;
if (satisfyPluginPlatformVersion('<7.11')) {
await PatternHandler.refreshIndexPattern();
}
this.isRefreshing = false;
this.reloadToast();
} catch (error) {
this.isRefreshing = false;
throw error;
}
} else if (this.isRefreshing) { // maybe this could be removed and the `isRefreshing` variable or does we expect the method could be called multiple times?
await new Promise((r) => setTimeout(r, 150));
await this.refreshKnownFields();
}
};
If we use component instance variables here, it would be interesting to apply the same change to the similar action for the Dashboard tab when there is a unknown field in some visualization. |
…g to release the message about the index pattern fields were refreshed only one time.
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.
review:
Code review ✔️
Test: ✔️
|
Hi team,
this pull request solves an asynchronism issue when multiple fields are missing in the Events view rows details. Once this PR is applied only 1 toast should pop informing the index pattern was updated.
Closes #3923
To test it try to reproduce the linked issue.