Skip to content

Commit

Permalink
memoize ChartSwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra committed Feb 17, 2021
1 parent 12df425 commit 87ae2ba
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import './chart_switch.scss';
import React, { useState, useMemo } from 'react';
import React, { useState, useMemo, memo } from 'react';
import {
EuiIcon,
EuiPopover,
Expand Down Expand Up @@ -79,7 +79,7 @@ function VisualizationSummary(props: Props) {
);
}

export function ChartSwitch(props: Props) {
export const ChartSwitch = memo(function ChartSwitch(props: Props) {
const [flyoutOpen, setFlyoutOpen] = useState<boolean>(false);

const commitSelection = (selection: VisualizationSelection) => {
Expand Down Expand Up @@ -305,7 +305,7 @@ export function ChartSwitch(props: Props) {
);

return <div className="lnsChartSwitch__header">{popover}</div>;
}
});

function getTopSuggestion(
props: Props,
Expand Down

0 comments on commit 87ae2ba

Please sign in to comment.