Revert "LegendIcon: only render color picker when the props change (#33141)" (#33313)

This reverts commit af46bbf654.
pull/33289/head^2
Dominik Prokop 5 years ago committed by GitHub
parent bf83fb80b7
commit d76c056656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      packages/grafana-ui/src/components/VizLegend/VizLegendSeriesIcon.tsx

@ -8,8 +8,10 @@ interface Props {
onColorChange: (color: string) => void; onColorChange: (color: string) => void;
} }
export const VizLegendSeriesIcon = React.memo<Props>( /**
({ disabled, color, onColorChange }) => { * @internal
*/
export const VizLegendSeriesIcon: React.FunctionComponent<Props> = ({ disabled, color, onColorChange }) => {
return disabled ? ( return disabled ? (
<SeriesIcon color={color} /> <SeriesIcon color={color} />
) : ( ) : (
@ -25,12 +27,6 @@ export const VizLegendSeriesIcon = React.memo<Props>(
)} )}
</SeriesColorPicker> </SeriesColorPicker>
); );
}, };
// areEqual -- return true if they are the same.
// onColorChange updates frequently, so ignore that
(prevProps, nextProps) => {
return prevProps.color === nextProps.color && prevProps.disabled === nextProps.disabled;
}
);
VizLegendSeriesIcon.displayName = 'VizLegendSeriesIcon'; VizLegendSeriesIcon.displayName = 'VizLegendSeriesIcon';

Loading…
Cancel
Save