Skip to content

Commit cd657ac

Browse files
Add _dashprivate_onFigureModified (plotly#865)
1 parent 394ccfd commit cd657ac

File tree

5 files changed

+114
-0
lines changed

5 files changed

+114
-0
lines changed

babel.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const presets = [
44
];
55

66
const plugins = [
7+
'@babel/plugin-proposal-nullish-coalescing-operator',
8+
'@babel/plugin-proposal-optional-chaining',
79
'@babel/plugin-syntax-dynamic-import'
810
];
911

package-lock.json

Lines changed: 99 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@
6161
"devDependencies": {
6262
"@babel/cli": "^7.4.0",
6363
"@babel/core": "^7.4.0",
64+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
6465
"@babel/plugin-proposal-object-rest-spread": "^7.4.0",
66+
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
6567
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
6668
"@babel/preset-env": "^7.4.1",
6769
"@babel/preset-react": "^7.0.0",

src/fragments/Graph.privateprops.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import PropTypes from 'prop-types';
33
export const privatePropTypes = {
44
_dashprivate_transformConfig: PropTypes.func,
55
_dashprivate_transformFigure: PropTypes.func,
6+
_dashprivate_onFigureModified: PropTypes.func,
67
};
78

89
export const privateDefaultProps = {
910
_dashprivate_transformConfig: c => c,
1011
_dashprivate_transformFigure: f => f,
12+
_dashprivate_onFigureModified: f => f,
1113
};

src/fragments/Graph.react.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ class PlotlyGraph extends Component {
214214
const gd = this.gd.current;
215215
return Plotly[plotlyFnKey](gd, updateData, traceIndices, maxPoints);
216216
});
217+
217218
clearState(dataKey);
218219
}
219220

@@ -352,6 +353,10 @@ class PlotlyGraph extends Component {
352353
if (this.props.extendData) {
353354
this.mergeTraces(this.props, 'extendData', 'extendTraces');
354355
}
356+
357+
if (this.props.prependData?.length || this.props.extendData?.length) {
358+
this.props._dashprivate_onFigureModified(this.props.figure);
359+
}
355360
}
356361

357362
componentWillUnmount() {
@@ -400,6 +405,10 @@ class PlotlyGraph extends Component {
400405
if (this.props.extendData !== nextProps.extendData) {
401406
this.mergeTraces(nextProps, 'extendData', 'extendTraces');
402407
}
408+
409+
if (this.props.prependData?.length || this.props.extendData?.length) {
410+
this.props._dashprivate_onFigureModified(this.props.figure);
411+
}
403412
}
404413

405414
componentDidUpdate(prevProps) {

0 commit comments

Comments
 (0)