Skip to content

Commit 8fc89e6

Browse files
author
Marc-André Rivet
committed
Merge remote-tracking branch 'origin/dev'
# Conflicts: # dash-renderer/package-lock.json
2 parents 619ed99 + 515846c commit 8fc89e6

File tree

15 files changed

+227
-235
lines changed

15 files changed

+227
-235
lines changed

CHANGELOG.md

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

5+
## [1.4.1] - 2019-10-17
6+
### Fixed
7+
- [#969](https://github.com/plotly/dash/pull/969) Fix warnings emitted by react devtools coming from our own devtools components.
8+
59
## [1.4.0] - 2019-10-08
610
### Added
711
- [#948](https://github.com/plotly/dash/pull/948) Support setting working directory for R apps run using the `dashr` fixture, primarily useful for tests with assets. `dashr.start_server` supports a `cwd` argument to set an explicit working directory, and has smarter defaults when it's omitted: if `app` is a path to an R script, uses the directory of that path; if `app` is a string, uses the directory the test file itself is in.

dash-renderer/package-lock.json

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

dash-renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-renderer",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "render dash components in react",
55
"main": "dash_renderer/dash_renderer.min.js",
66
"scripts": {

dash-renderer/src/actions/constants.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const actionList = {
77
SET_APP_LIFECYCLE: 'SET_APP_LIFECYCLE',
88
SET_CONFIG: 'SET_CONFIG',
99
ON_ERROR: 'ON_ERROR',
10-
RESOLVE_ERROR: 'RESOLVE_ERROR',
1110
SET_HOOKS: 'SET_HOOKS',
1211
};
1312

dash-renderer/src/actions/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export const setAppLifecycle = createAction(getAction('SET_APP_LIFECYCLE'));
4343
export const setConfig = createAction(getAction('SET_CONFIG'));
4444
export const setHooks = createAction(getAction('SET_HOOKS'));
4545
export const onError = createAction(getAction('ON_ERROR'));
46-
export const resolveError = createAction(getAction('RESOLVE_ERROR'));
4746

4847
export function hydrateInitialOutputs() {
4948
return function(dispatch, getState) {

dash-renderer/src/components/error/ComponentErrorBoundary.react.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {connect} from 'react-redux';
22
import {Component} from 'react';
33
import PropTypes from 'prop-types';
44
import Radium from 'radium';
5-
import {includes, pluck} from 'ramda';
65
import uniqid from 'uniqid';
76
import {onError, revert} from '../../actions';
87

@@ -13,9 +12,14 @@ class UnconnectedComponentErrorBoundary extends Component {
1312
myID: props.componentId,
1413
myUID: uniqid(),
1514
oldChildren: null,
15+
hasError: false,
1616
};
1717
}
1818

19+
static getDerivedStateFromError(_) {
20+
return {hasError: true};
21+
}
22+
1923
componentDidCatch(error, info) {
2024
const {dispatch} = this.props;
2125
dispatch(
@@ -32,30 +36,22 @@ class UnconnectedComponentErrorBoundary extends Component {
3236

3337
/* eslint-disable react/no-did-update-set-state */
3438
componentDidUpdate(prevProps, prevState) {
35-
const {error} = this.props;
36-
const {myUID} = this.state;
37-
const hasError = includes(myUID, pluck('myUID')(error.frontEnd));
39+
const prevChildren = prevProps.children;
3840
if (
39-
!hasError &&
40-
prevState.oldChildren !== prevProps.children &&
41-
prevProps.children !== this.props.children
41+
!this.state.hasError &&
42+
prevChildren !== prevState.oldChildren &&
43+
prevChildren !== this.props.children
4244
) {
4345
this.setState({
44-
oldChildren: prevProps.children,
46+
oldChildren: prevChildren,
4547
});
4648
}
4749
}
4850
/* eslint-enable react/no-did-update-set-state */
4951

5052
render() {
51-
const {error} = this.props;
52-
const {myUID} = this.state;
53-
const hasError = includes(myUID, pluck('myUID')(error.frontEnd));
54-
55-
if (hasError) {
56-
return this.state.oldChildren;
57-
}
58-
return this.props.children;
53+
const {hasError, oldChildren} = this.state;
54+
return hasError ? oldChildren : this.props.children;
5955
}
6056
}
6157

dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,12 @@ class FrontEndError extends Component {
1717
}
1818

1919
render() {
20-
const {e, resolve, inAlertsTray} = this.props;
20+
const {e, inAlertsTray} = this.props;
2121
const {collapsed} = this.state;
2222

23-
let cardClasses;
24-
// if resolve is defined, the error should be a standalone card
25-
if (resolve) {
26-
cardClasses = 'dash-error-card';
27-
} else {
28-
cardClasses = 'dash-error-card__content';
29-
}
30-
if (inAlertsTray) {
31-
cardClasses += ' dash-error-card--alerts-tray';
32-
}
23+
const cardClasses =
24+
'dash-error-card__content' +
25+
(inAlertsTray ? ' dash-error-card--alerts-tray' : '');
3326

3427
/* eslint-disable no-inline-comments */
3528
const errorHeader = (
@@ -178,7 +171,6 @@ FrontEndError.propTypes = {
178171
timestamp: PropTypes.object,
179172
error: errorPropTypes,
180173
}),
181-
resolve: PropTypes.func,
182174
inAlertsTray: PropTypes.bool,
183175
isListItem: PropTypes.bool,
184176
};

dash-renderer/src/components/error/FrontEnd/FrontEndErrorContainer.react.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class FrontEndErrorContainer extends Component {
1717
const inAlertsTray = this.props.inAlertsTray;
1818
let cardClasses = 'dash-error-card dash-error-card--container';
1919

20-
const errorElements = this.props.errors.map(error => {
21-
return <FrontEndError e={error} isListItem={true} />;
20+
const errorElements = this.props.errors.map((error, i) => {
21+
return <FrontEndError e={error} isListItem={true} key={i} />;
2222
});
2323
if (inAlertsTray) {
2424
cardClasses += ' dash-error-card--alerts-tray';
@@ -42,7 +42,6 @@ class FrontEndErrorContainer extends Component {
4242

4343
FrontEndErrorContainer.propTypes = {
4444
errors: PropTypes.array,
45-
resolve: PropTypes.func,
4645
inAlertsTray: PropTypes.any,
4746
};
4847

dash-renderer/src/components/error/GlobalErrorContainer.react.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,20 @@ import {connect} from 'react-redux';
22
import React, {Component} from 'react';
33
import PropTypes from 'prop-types';
44
import Radium from 'radium';
5-
import {resolveError} from '../../actions';
65
import {DebugMenu} from './menu/DebugMenu.react';
76

87
class UnconnectedGlobalErrorContainer extends Component {
98
constructor(props) {
109
super(props);
1110
}
1211

13-
resolveError(dispatch, type, myId) {
14-
if (type === 'backEnd') {
15-
dispatch(resolveError({type}));
16-
// dispatch(revert);
17-
} else {
18-
dispatch(resolveError({myId, type}));
19-
}
20-
}
21-
2212
render() {
23-
const {error, dispatch, dependenciesRequest} = this.props;
13+
const {error, dependenciesRequest} = this.props;
2414
return (
2515
<div id="_dash-global-error-container">
2616
<DebugMenu
2717
error={error}
2818
dependenciesRequest={dependenciesRequest}
29-
dispatch={dispatch}
30-
resolveError={this.resolveError}
3119
>
3220
<div id="_dash-app-content">{this.props.children}</div>
3321
</DebugMenu>
@@ -40,15 +28,11 @@ UnconnectedGlobalErrorContainer.propTypes = {
4028
children: PropTypes.object,
4129
error: PropTypes.object,
4230
dependenciesRequest: PropTypes.object,
43-
dispatch: PropTypes.func,
4431
};
4532

46-
const GlobalErrorContainer = connect(
47-
state => ({
48-
error: state.error,
49-
dependenciesRequest: state.dependenciesRequest,
50-
}),
51-
dispatch => ({dispatch})
52-
)(Radium(UnconnectedGlobalErrorContainer));
33+
const GlobalErrorContainer = connect(state => ({
34+
error: state.error,
35+
dependenciesRequest: state.dependenciesRequest,
36+
}))(Radium(UnconnectedGlobalErrorContainer));
5337

5438
export default GlobalErrorContainer;

dash-renderer/src/components/error/GlobalErrorOverlay.react.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ export default class GlobalErrorOverlay extends Component {
1111
}
1212

1313
render() {
14-
const {resolve, visible, error, toastsEnabled} = this.props;
14+
const {visible, error, toastsEnabled} = this.props;
1515

1616
let frontEndErrors;
1717
if (toastsEnabled) {
1818
const errors = concat(error.frontEnd, error.backEnd);
1919

20-
frontEndErrors = (
21-
<FrontEndErrorContainer errors={errors} resolve={resolve} />
22-
);
20+
frontEndErrors = <FrontEndErrorContainer errors={errors} />;
2321
}
2422
return (
2523
<div>
@@ -36,7 +34,6 @@ export default class GlobalErrorOverlay extends Component {
3634

3735
GlobalErrorOverlay.propTypes = {
3836
children: PropTypes.object,
39-
resolve: PropTypes.func,
4037
visible: PropTypes.bool,
4138
error: PropTypes.object,
4239
toastsEnabled: PropTypes.any,

0 commit comments

Comments
 (0)