Skip to content

Commit

Permalink
tiny embeddable state change performance optimization (#79646)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
Dosant and kibanamachine authored Oct 12, 2020
1 parent de6855b commit 356c017
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { EuiContextMenuPanelDescriptor, EuiPanel, htmlIdGenerator } from '@elast
import classNames from 'classnames';
import React from 'react';
import { Subscription } from 'rxjs';
import deepEqual from 'fast-deep-equal';
import { buildContextMenuForActions, UiActionsService, Action } from '../ui_actions';
import { CoreStart, OverlayStart } from '../../../../../core/public';
import { toMountPoint } from '../../../../kibana_react/public';
Expand Down Expand Up @@ -123,9 +124,11 @@ export class EmbeddablePanel extends React.Component<Props, State> {
badges = badges.filter((badge) => disabledActions.indexOf(badge.id) === -1);
}

this.setState({
badges,
});
if (!deepEqual(this.state.badges, badges)) {
this.setState({
badges,
});
}
}

private async refreshNotifications() {
Expand All @@ -139,9 +142,11 @@ export class EmbeddablePanel extends React.Component<Props, State> {
notifications = notifications.filter((badge) => disabledActions.indexOf(badge.id) === -1);
}

this.setState({
notifications,
});
if (!deepEqual(this.state.notifications, notifications)) {
this.setState({
notifications,
});
}
}

public UNSAFE_componentWillMount() {
Expand Down

0 comments on commit 356c017

Please sign in to comment.