Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	dash-renderer/package-lock.json
  • Loading branch information
Marc-André Rivet committed Oct 17, 2019
2 parents 619ed99 + 515846c commit 8fc89e6
Show file tree
Hide file tree
Showing 15 changed files with 227 additions and 235 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to `dash` will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.1] - 2019-10-17
### Fixed
- [#969](https://github.com/plotly/dash/pull/969) Fix warnings emitted by react devtools coming from our own devtools components.

## [1.4.0] - 2019-10-08
### Added
- [#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.
Expand Down
331 changes: 190 additions & 141 deletions dash-renderer/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-renderer",
"version": "1.1.1",
"version": "1.1.2",
"description": "render dash components in react",
"main": "dash_renderer/dash_renderer.min.js",
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion dash-renderer/src/actions/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const actionList = {
SET_APP_LIFECYCLE: 'SET_APP_LIFECYCLE',
SET_CONFIG: 'SET_CONFIG',
ON_ERROR: 'ON_ERROR',
RESOLVE_ERROR: 'RESOLVE_ERROR',
SET_HOOKS: 'SET_HOOKS',
};

Expand Down
1 change: 0 additions & 1 deletion dash-renderer/src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const setAppLifecycle = createAction(getAction('SET_APP_LIFECYCLE'));
export const setConfig = createAction(getAction('SET_CONFIG'));
export const setHooks = createAction(getAction('SET_HOOKS'));
export const onError = createAction(getAction('ON_ERROR'));
export const resolveError = createAction(getAction('RESOLVE_ERROR'));

export function hydrateInitialOutputs() {
return function(dispatch, getState) {
Expand Down
28 changes: 12 additions & 16 deletions dash-renderer/src/components/error/ComponentErrorBoundary.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {connect} from 'react-redux';
import {Component} from 'react';
import PropTypes from 'prop-types';
import Radium from 'radium';
import {includes, pluck} from 'ramda';
import uniqid from 'uniqid';
import {onError, revert} from '../../actions';

Expand All @@ -13,9 +12,14 @@ class UnconnectedComponentErrorBoundary extends Component {
myID: props.componentId,
myUID: uniqid(),
oldChildren: null,
hasError: false,
};
}

static getDerivedStateFromError(_) {
return {hasError: true};
}

componentDidCatch(error, info) {
const {dispatch} = this.props;
dispatch(
Expand All @@ -32,30 +36,22 @@ class UnconnectedComponentErrorBoundary extends Component {

/* eslint-disable react/no-did-update-set-state */
componentDidUpdate(prevProps, prevState) {
const {error} = this.props;
const {myUID} = this.state;
const hasError = includes(myUID, pluck('myUID')(error.frontEnd));
const prevChildren = prevProps.children;
if (
!hasError &&
prevState.oldChildren !== prevProps.children &&
prevProps.children !== this.props.children
!this.state.hasError &&
prevChildren !== prevState.oldChildren &&
prevChildren !== this.props.children
) {
this.setState({
oldChildren: prevProps.children,
oldChildren: prevChildren,
});
}
}
/* eslint-enable react/no-did-update-set-state */

render() {
const {error} = this.props;
const {myUID} = this.state;
const hasError = includes(myUID, pluck('myUID')(error.frontEnd));

if (hasError) {
return this.state.oldChildren;
}
return this.props.children;
const {hasError, oldChildren} = this.state;
return hasError ? oldChildren : this.props.children;
}
}

Expand Down
16 changes: 4 additions & 12 deletions dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,12 @@ class FrontEndError extends Component {
}

render() {
const {e, resolve, inAlertsTray} = this.props;
const {e, inAlertsTray} = this.props;
const {collapsed} = this.state;

let cardClasses;
// if resolve is defined, the error should be a standalone card
if (resolve) {
cardClasses = 'dash-error-card';
} else {
cardClasses = 'dash-error-card__content';
}
if (inAlertsTray) {
cardClasses += ' dash-error-card--alerts-tray';
}
const cardClasses =
'dash-error-card__content' +
(inAlertsTray ? ' dash-error-card--alerts-tray' : '');

/* eslint-disable no-inline-comments */
const errorHeader = (
Expand Down Expand Up @@ -178,7 +171,6 @@ FrontEndError.propTypes = {
timestamp: PropTypes.object,
error: errorPropTypes,
}),
resolve: PropTypes.func,
inAlertsTray: PropTypes.bool,
isListItem: PropTypes.bool,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class FrontEndErrorContainer extends Component {
const inAlertsTray = this.props.inAlertsTray;
let cardClasses = 'dash-error-card dash-error-card--container';

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

FrontEndErrorContainer.propTypes = {
errors: PropTypes.array,
resolve: PropTypes.func,
inAlertsTray: PropTypes.any,
};

Expand Down
26 changes: 5 additions & 21 deletions dash-renderer/src/components/error/GlobalErrorContainer.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,20 @@ import {connect} from 'react-redux';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Radium from 'radium';
import {resolveError} from '../../actions';
import {DebugMenu} from './menu/DebugMenu.react';

class UnconnectedGlobalErrorContainer extends Component {
constructor(props) {
super(props);
}

resolveError(dispatch, type, myId) {
if (type === 'backEnd') {
dispatch(resolveError({type}));
// dispatch(revert);
} else {
dispatch(resolveError({myId, type}));
}
}

render() {
const {error, dispatch, dependenciesRequest} = this.props;
const {error, dependenciesRequest} = this.props;
return (
<div id="_dash-global-error-container">
<DebugMenu
error={error}
dependenciesRequest={dependenciesRequest}
dispatch={dispatch}
resolveError={this.resolveError}
>
<div id="_dash-app-content">{this.props.children}</div>
</DebugMenu>
Expand All @@ -40,15 +28,11 @@ UnconnectedGlobalErrorContainer.propTypes = {
children: PropTypes.object,
error: PropTypes.object,
dependenciesRequest: PropTypes.object,
dispatch: PropTypes.func,
};

const GlobalErrorContainer = connect(
state => ({
error: state.error,
dependenciesRequest: state.dependenciesRequest,
}),
dispatch => ({dispatch})
)(Radium(UnconnectedGlobalErrorContainer));
const GlobalErrorContainer = connect(state => ({
error: state.error,
dependenciesRequest: state.dependenciesRequest,
}))(Radium(UnconnectedGlobalErrorContainer));

export default GlobalErrorContainer;
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ export default class GlobalErrorOverlay extends Component {
}

render() {
const {resolve, visible, error, toastsEnabled} = this.props;
const {visible, error, toastsEnabled} = this.props;

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

frontEndErrors = (
<FrontEndErrorContainer errors={errors} resolve={resolve} />
);
frontEndErrors = <FrontEndErrorContainer errors={errors} />;
}
return (
<div>
Expand All @@ -36,7 +34,6 @@ export default class GlobalErrorOverlay extends Component {

GlobalErrorOverlay.propTypes = {
children: PropTypes.object,
resolve: PropTypes.func,
visible: PropTypes.bool,
error: PropTypes.object,
toastsEnabled: PropTypes.any,
Expand Down
5 changes: 1 addition & 4 deletions dash-renderer/src/components/error/menu/DebugMenu.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DebugMenu extends Component {
toastsEnabled,
callbackGraphOpened,
} = this.state;
const {error, resolveError, dispatch, dependenciesRequest} = this.props;
const {error, dependenciesRequest} = this.props;

const menuClasses = opened
? 'dash-debug-menu dash-debug-menu--opened'
Expand Down Expand Up @@ -136,7 +136,6 @@ class DebugMenu extends Component {
{menuContent}
</div>
<GlobalErrorOverlay
resolve={(type, myId) => resolveError(dispatch, type, myId)}
error={error}
visible={
!(isEmpty(error.backEnd) && isEmpty(error.frontEnd))
Expand All @@ -154,8 +153,6 @@ DebugMenu.propTypes = {
children: PropTypes.object,
error: PropTypes.object,
dependenciesRequest: PropTypes.object,
resolveError: PropTypes.func,
dispatch: PropTypes.func,
};

export {DebugMenu};
27 changes: 2 additions & 25 deletions dash-renderer/src/reducers/error.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {findIndex, mergeRight, propEq, remove} from 'ramda';
import {mergeRight} from 'ramda';

const initialError = {
frontEnd: [],
backEnd: [],
};

function error(state = initialError, action) {
export default function error(state = initialError, action) {
switch (action.type) {
case 'ON_ERROR': {
if (action.payload.type === 'frontEnd') {
Expand All @@ -28,31 +28,8 @@ function error(state = initialError, action) {
return state;
}

case 'RESOLVE_ERROR': {
if (action.payload.type === 'frontEnd') {
const removeIdx = findIndex(
propEq('myUID', action.payload.myUID)
)(state.frontEnd);
return {
frontEnd: remove(removeIdx, 1, state.frontEnd),
backEnd: state.backEnd,
};
} else if (action.payload.type === 'backEnd') {
const removeIdx = findIndex(
propEq('myUID', action.payload.myUID)
)(state.backEnd);
return {
frontEnd: state.frontEnd,
backEnd: remove(removeIdx, 1, state.backEnd),
};
}
return state;
}

default: {
return state;
}
}
}

export default error;
1 change: 0 additions & 1 deletion dash-renderer/version.py

This file was deleted.

2 changes: 1 addition & 1 deletion dash/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.4.0'
__version__ = '1.4.1'
6 changes: 3 additions & 3 deletions requires-install.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Flask>=1.0.2
flask-compress
plotly
dash_renderer==1.1.1
dash-core-components==1.3.0
dash_renderer==1.1.2
dash-core-components==1.3.1
dash-html-components==1.0.1
dash-table==4.4.0
dash-table==4.4.1
future

0 comments on commit 8fc89e6

Please sign in to comment.