[Lens] only reload embeddable when a new message was actually added (#149424)

This commit is contained in:
Andrew Tate 2023-01-24 15:26:39 -06:00 committed by GitHub
parent 4c9a76cabd
commit ed51f0f1ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -552,10 +552,9 @@ export class Embeddable
if (addedMessageIds.length) {
this.additionalUserMessages = newMessageMap;
this.renderBadgeMessages();
}
this.reload();
return () => {
const withMessagesRemoved = {
...this.additionalUserMessages,
@ -712,15 +711,11 @@ export class Embeddable
const newActiveData = adapters?.tables?.tables;
if (!fastIsEqual(this.activeData, newActiveData)) {
// we check equality because this.addUserMessage triggers a render, so we get an infinite loop
// if we just execute without checking if the data has changed
this.removeActiveDataWarningMessages();
const searchWarningMessages = this.getSearchWarningMessages(adapters);
this.removeActiveDataWarningMessages = this.addUserMessages(
searchWarningMessages.filter(isMessageRemovable)
);
}
this.removeActiveDataWarningMessages();
const searchWarningMessages = this.getSearchWarningMessages(adapters);
this.removeActiveDataWarningMessages = this.addUserMessages(
searchWarningMessages.filter(isMessageRemovable)
);
this.activeData = newActiveData;
};
@ -880,6 +875,10 @@ export class Embeddable
domNode
);
this.renderBadgeMessages();
}
private renderBadgeMessages() {
const warningsToDisplay = this.getUserMessages('embeddableBadge', {
severity: 'warning',
});