Skip to content

Commit 86fe15c

Browse files
committed
Fix #509
1 parent cf6a44c commit 86fe15c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/EditorControls.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@ class EditorControls extends Component {
119119
this.props.beforeAddTrace(payload);
120120
}
121121

122-
graphDiv.data.push(this.props.useAsDefaultTrace);
122+
// can't use default prop because plotly.js mutates it:
123+
// https://github.com/plotly/react-chart-editor/issues/509
124+
graphDiv.data.push(
125+
this.props.useAsDefaultTrace
126+
? this.props.useAsDefaultTrace
127+
: {type: 'scatter', mode: 'markers'}
128+
);
123129

124130
if (this.props.afterAddTrace) {
125131
this.props.afterAddTrace(payload);
@@ -311,7 +317,6 @@ EditorControls.defaultProps = {
311317
traces: _ => traceTypes(_),
312318
complex: true,
313319
},
314-
useAsDefaultTrace: {type: 'scatter', mode: 'markers'},
315320
};
316321

317322
EditorControls.childContextTypes = {

0 commit comments

Comments
 (0)