@@ -119,7 +119,9 @@ 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 ( this . props . makeDefaultTrace ( ) ) ;
123125
124126 if ( this . props . afterAddTrace ) {
125127 this . props . afterAddTrace ( payload ) ;
@@ -300,18 +302,18 @@ EditorControls.propTypes = {
300302 plotly : PropTypes . object ,
301303 showFieldTooltips : PropTypes . bool ,
302304 traceTypesConfig : PropTypes . object ,
303- useAsDefaultTrace : PropTypes . object ,
305+ makeDefaultTrace : PropTypes . func ,
304306} ;
305307
306308EditorControls . defaultProps = {
307309 showFieldTooltips : false ,
308310 locale : 'en' ,
311+ makeDefaultTrace : ( ) => ( { type : 'scatter' , mode : 'markers' } ) ,
309312 traceTypesConfig : {
310313 categories : _ => categoryLayout ( _ ) ,
311314 traces : _ => traceTypes ( _ ) ,
312315 complex : true ,
313316 } ,
314- useAsDefaultTrace : { type : 'scatter' , mode : 'markers' } ,
315317} ;
316318
317319EditorControls . childContextTypes = {
0 commit comments