Skip to content

Commit 00778b6

Browse files
committed
only do the customConfig validation once
1 parent d118796 commit 00778b6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/EditorControls.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import DefaultEditor from './DefaultEditor';
22
import PropTypes from 'prop-types';
33
import React, {Component} from 'react';
4-
import {bem, localizeString, plotlyTraceToCustomTrace, traceTypeToPlotlyInitFigure} from './lib';
4+
import {
5+
bem,
6+
localizeString,
7+
plotlyTraceToCustomTrace,
8+
traceTypeToPlotlyInitFigure,
9+
hasValidCustomConfigVisibilityRules,
10+
} from './lib';
511
import {
612
shamefullyClearAxisTypes,
713
shamefullyAdjustAxisRef,
@@ -60,6 +66,9 @@ class EditorControls extends Component {
6066
fontOptions: this.props.fontOptions,
6167
chartHelp: this.props.chartHelp,
6268
customConfig: this.props.customConfig,
69+
hasValidCustomConfigVisibilityRules: hasValidCustomConfigVisibilityRules(
70+
this.props.customConfig
71+
),
6372
};
6473
}
6574

@@ -435,6 +444,7 @@ EditorControls.childContextTypes = {
435444
fontOptions: PropTypes.array,
436445
chartHelp: PropTypes.object,
437446
customConfig: PropTypes.object,
447+
hasValidCustomConfigVisibilityRules: PropTypes.bool,
438448
};
439449

440450
export default EditorControls;

src/lib/unpackPlotProps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function validateVisibilityWithCustomConfig(
9898
componentDisplayName
9999
) {
100100
let show = initial;
101-
if (show && hasValidCustomConfigVisibilityRules(nextContext.customConfig)) {
101+
if (show && nextContext.hasValidCustomConfigVisibilityRules) {
102102
show = computeCustomConfigVisibility(nextProps, nextContext.customConfig, componentDisplayName);
103103
}
104104
return show;

0 commit comments

Comments
 (0)