Skip to content

Commit 1f18e39

Browse files
authored
Merge pull request #2247 from plotly/master-2.6.2
Master 2.6.2
2 parents d0d7749 + 51779f4 commit 1f18e39

File tree

228 files changed

+2737
-5254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+2737
-5254
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ jobs:
294294
. venv/bin/activate && rm -rf components/dash-core-components/dash_core_components
295295
cd components/dash-core-components
296296
TESTFILES=$(circleci tests glob "tests/integration/**/test_*.py" | circleci tests split --split-by=timings)
297-
pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml --junitprefix="components.dash-core-components" ${TESTFILES} --reruns 3
297+
pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml --junitprefix="components.dash-core-components" ${TESTFILES}
298298
- store_artifacts:
299299
path: ~/dash/components/dash-core-components/test-reports
300300
- store_test_results:

@plotly/dash-component-plugins/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Plotly, Inc
3+
Copyright (c) 2022 Plotly, Inc
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import { RequiredChildrenComponentProps } from "../props";
3+
4+
5+
const RequiredChildrenComponent = (props: RequiredChildrenComponentProps) => {
6+
const {children} = props;
7+
return (
8+
<div>
9+
{children}
10+
</div>
11+
)
12+
}
13+
14+
export default RequiredChildrenComponent;

@plotly/dash-generator-test-component-typescript/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import WrappedHTML from './components/WrappedHTML';
66
import FCComponent from './components/FCComponent';
77
import EmptyComponent from './components/EmptyComponent';
88
import MixedComponent from './components/MixedComponent';
9+
import RequiredChildrenComponent from './components/RequiredChildrenComponent';
910

1011
export {
1112
TypeScriptComponent,
@@ -16,4 +17,5 @@ export {
1617
FCComponent,
1718
EmptyComponent,
1819
MixedComponent,
20+
RequiredChildrenComponent,
1921
};

@plotly/dash-generator-test-component-typescript/src/props.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,7 @@ export type WrappedHTMLProps = {
4848
children?: React.ReactNode;
4949
id?: string;
5050
} & Pick<React.ButtonHTMLAttributes<any>, 'autoFocus'>
51+
52+
export type RequiredChildrenComponentProps = {
53+
children: React.ReactNode;
54+
}

@plotly/dash-test-components/src/components/ComponentAsProp.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import PropTypes from 'prop-types';
33

44

55
const ComponentAsProp = (props) => {
6-
const { element, id, shapeEl, list_of_shapes } = props;
6+
const { element, id, shapeEl, list_of_shapes, multi_components } = props;
77
return (
88
<div id={id}>
99
{shapeEl && shapeEl.header}
1010
{element}
1111
{shapeEl && shapeEl.footer}
1212
{list_of_shapes && <ul>{list_of_shapes.map(e => <li key={e.value}>{e.label}</li>)}</ul> }
13+
{multi_components && <div>{multi_components.map(m => <div id={m.id} key={m.id}>{m.first} - {m.second}</div>)}</div>}
1314
</div>
1415
)
1516
}
@@ -28,6 +29,14 @@ ComponentAsProp.propTypes = {
2829
label: PropTypes.node,
2930
value: PropTypes.number,
3031
})
32+
),
33+
34+
multi_components: PropTypes.arrayOf(
35+
PropTypes.exact({
36+
id: PropTypes.string,
37+
first: PropTypes.node,
38+
second: PropTypes.node,
39+
})
3140
)
3241
}
3342

@plotly/webpack-dash-dynamic-import/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Plotly, Inc
3+
Copyright (c) 2022 Plotly, Inc
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## [2.6.2] - 2022-09-23
6+
7+
### Fixed
8+
9+
- [#2237](https://github.com/plotly/dash/pull/2237) Ensure calls to `plotly.js` from `dcc.Graph` are properly sequenced even if React initiates multiple render cycles in quick succession.
10+
- [#2218](https://github.com/plotly/dash/pull/2218) Fix bug [#1348](https://github.com/plotly/dash/issues/1348) Validate children prop (required or not).
11+
- [#2223](https://github.com/plotly/dash/pull/2223) Exclude hidden folders when building `dash.page_registry`.
12+
- [#2182](https://github.com/plotly/dash/pull/2182) Fix [#2172](https://github.com/plotly/dash/issues/2172) Make it so that when using pages, if `suppress_callback_exceptions=True` the `validation_layout` is not set.
13+
- [#2152](https://github.com/plotly/dash/pull/2152) Fix bug [#2128](https://github.com/plotly/dash/issues/2128) preventing rendering of multiple components inside a dictionary.
14+
- [#2187](https://github.com/plotly/dash/pull/2187) Fix confusing error message when trying to use pytest fixtures but `dash[testing]` is not installed.
15+
- [#2202](https://github.com/plotly/dash/pull/2202) Fix bug [#2185](https://github.com/plotly/dash/issues/2185) when you copy text with multiple quotes into a table
16+
- [#2226](https://github.com/plotly/dash/pull/2226) Fix [#2219](https://github.com/plotly/dash/issues/2219) pages register & background callbacks.
17+
518
## [2.6.1] - 2022-08-01
619

720
### Fixed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2021 Plotly, Inc
3+
Copyright (c) 2022 Plotly, Inc
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

components/dash-core-components/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2019 Plotly Technologies
3+
Copyright (c) 2022 Plotly Technologies
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

components/dash-core-components/package-lock.json

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

components/dash-core-components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-core-components",
3-
"version": "2.6.1",
3+
"version": "2.6.2",
44
"description": "Core component suite for Dash",
55
"repository": {
66
"type": "git",
@@ -21,7 +21,7 @@
2121
"private::lint.prettier": "prettier --config .prettierrc src/**/*.js --list-different",
2222
"prepublishOnly": "rm -rf lib && babel src --out-dir lib --copy-files --config-file ./.lib.babelrc && rm -rf lib/jl/ lib/*.jl",
2323
"test": "run-s -c lint test:intg test:pyimport",
24-
"test:intg": "pytest --nopercyfinalize --headless tests/integration --reruns 3",
24+
"test:intg": "pytest --nopercyfinalize --headless tests/integration ",
2525
"test:pyimport": "python -m unittest tests/test_dash_import.py",
2626
"prebuild:js": "cp node_modules/plotly.js-dist-min/plotly.min.js dash_core_components_base/plotly.min.js",
2727
"build:js": "webpack --mode production",

components/dash-core-components/src/components/Markdown.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ DashMarkdown.propTypes = {
5959
link_target: PropTypes.string,
6060

6161
/**
62-
* A markdown string (or array of strings) that adhreres to the CommonMark spec
62+
* A markdown string (or array of strings) that adheres to the CommonMark spec
6363
*/
6464
children: PropTypes.oneOfType([
6565
PropTypes.string,

components/dash-core-components/src/fragments/Graph.react.js

Lines changed: 72 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class PlotlyGraph extends Component {
136136
this.gd = React.createRef();
137137
this._hasPlotted = false;
138138
this._prevGd = null;
139+
this._queue = Promise.resolve();
139140

140141
this.bindEvents = this.bindEvents.bind(this);
141142
this.getConfig = this.getConfig.bind(this);
@@ -144,6 +145,7 @@ class PlotlyGraph extends Component {
144145
this.getLayoutOverride = this.getLayoutOverride.bind(this);
145146
this.graphResize = this.graphResize.bind(this);
146147
this.isResponsive = this.isResponsive.bind(this);
148+
this.amendTraces = this.amendTraces.bind(this);
147149

148150
this.state = {override: {}, originals: {}};
149151
}
@@ -219,41 +221,78 @@ class PlotlyGraph extends Component {
219221
});
220222
}
221223

222-
mergeTraces(props, dataKey, plotlyFnKey) {
223-
const clearState = props.clearState;
224-
const dataArray = props[dataKey];
224+
amendTraces(p, oldProps, newProps) {
225+
const {prependData: oldPrepend, extendData: oldExtend} = oldProps;
226+
const {prependData: newPrepend, extendData: newExtend} = newProps;
227+
const _this = this;
225228

226-
let p = Promise.resolve();
229+
function mergeTraces(props, dataKey, plotlyFnKey) {
230+
const clearState = props.clearState;
231+
const dataArray = props[dataKey];
227232

228-
dataArray.forEach(data => {
229-
let updateData, traceIndices, maxPoints;
230-
if (Array.isArray(data) && typeof data[0] === 'object') {
231-
[updateData, traceIndices, maxPoints] = data;
232-
} else {
233-
updateData = data;
234-
}
233+
let _p = Promise.resolve();
235234

236-
if (!traceIndices) {
237-
function getFirstProp(data) {
238-
return data[Object.keys(data)[0]];
235+
dataArray.forEach(data => {
236+
let updateData, traceIndices, maxPoints;
237+
if (Array.isArray(data) && typeof data[0] === 'object') {
238+
[updateData, traceIndices, maxPoints] = data;
239+
} else {
240+
updateData = data;
239241
}
240242

241-
function generateIndices(data) {
242-
return Array.from(Array(getFirstProp(data).length).keys());
243+
if (!traceIndices) {
244+
function getFirstProp(data) {
245+
return data[Object.keys(data)[0]];
246+
}
247+
248+
function generateIndices(data) {
249+
return Array.from(
250+
Array(getFirstProp(data).length).keys()
251+
);
252+
}
253+
traceIndices = generateIndices(updateData);
243254
}
244-
traceIndices = generateIndices(updateData);
245-
}
246255

247-
p = p.then(() => {
248-
const gd = this.gd.current;
249-
return (
250-
gd &&
251-
Plotly[plotlyFnKey](gd, updateData, traceIndices, maxPoints)
252-
);
256+
_p = _p.then(() => {
257+
const gd = _this.gd.current;
258+
return (
259+
gd &&
260+
Plotly[plotlyFnKey](
261+
gd,
262+
updateData,
263+
traceIndices,
264+
maxPoints
265+
)
266+
);
267+
});
253268
});
254-
});
255269

256-
p.then(() => clearState(dataKey));
270+
return _p.then(() => clearState(dataKey));
271+
}
272+
273+
let modified = false;
274+
275+
if (newPrepend?.length && oldPrepend !== newPrepend) {
276+
modified = true;
277+
p = p.then(() =>
278+
mergeTraces(newProps, 'prependData', 'prependTraces')
279+
);
280+
}
281+
282+
if (newExtend?.length && oldExtend !== newExtend) {
283+
modified = true;
284+
p = p.then(() =>
285+
mergeTraces(newProps, 'extendData', 'extendTraces')
286+
);
287+
}
288+
289+
if (modified) {
290+
p = p.then(() =>
291+
newProps._dashprivate_onFigureModified(newProps.figure)
292+
);
293+
}
294+
295+
return p;
257296
}
258297

259298
getConfig(config, responsive) {
@@ -405,23 +444,8 @@ class PlotlyGraph extends Component {
405444
}
406445

407446
componentDidMount() {
408-
let p = this.plot(this.props);
409-
if (this.props.prependData) {
410-
p = p.then(() =>
411-
this.mergeTraces(this.props, 'prependData', 'prependTraces')
412-
);
413-
}
414-
if (this.props.extendData) {
415-
p = p.then(() =>
416-
this.mergeTraces(this.props, 'extendData', 'extendTraces')
417-
);
418-
}
419-
420-
if (this.props.prependData?.length || this.props.extendData?.length) {
421-
p.then(() =>
422-
this.props._dashprivate_onFigureModified(this.props.figure)
423-
);
424-
}
447+
const p = this.plot(this.props);
448+
this._queue = this.amendTraces(p, {}, this.props);
425449
}
426450

427451
componentWillUnmount() {
@@ -454,7 +478,8 @@ class PlotlyGraph extends Component {
454478
return;
455479
}
456480

457-
let p = Promise.resolve();
481+
let p = this._queue;
482+
458483
if (
459484
this.props.mathjax !== nextProps.mathjax ||
460485
this.props.figure !== nextProps.figure ||
@@ -463,34 +488,18 @@ class PlotlyGraph extends Component {
463488
this.props._dashprivate_transformFigure !==
464489
nextProps._dashprivate_transformFigure
465490
) {
466-
p = this.plot(nextProps);
491+
p = p.then(() => this.plot(nextProps));
467492
}
468493

469-
if (this.props.prependData !== nextProps.prependData) {
470-
p = p.then(() =>
471-
this.mergeTraces(nextProps, 'prependData', 'prependTraces')
472-
);
473-
}
474-
475-
if (this.props.extendData !== nextProps.extendData) {
476-
p = p.then(() =>
477-
this.mergeTraces(nextProps, 'extendData', 'extendTraces')
478-
);
479-
}
480-
481-
if (this.props.prependData?.length || this.props.extendData?.length) {
482-
p.then(() =>
483-
this.props._dashprivate_onFigureModified(this.props.figure)
484-
);
485-
}
494+
this._queue = this.amendTraces(p, this.props, nextProps);
486495
}
487496

488497
componentDidUpdate(prevProps) {
489498
if (
490499
prevProps.id !== this.props.id ||
491500
prevProps.mathjax !== this.props.mathjax
492501
) {
493-
this.plot(this.props);
502+
this._queue = this._queue.then(() => this.plot(this.props));
494503
}
495504
}
496505

0 commit comments

Comments
 (0)