Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #73 from plotly/hot-reload
Browse files Browse the repository at this point in the history
Hot reload
  • Loading branch information
T4rk1n authored Nov 14, 2018
2 parents b1cfc99 + cabf3e3 commit a38da62
Show file tree
Hide file tree
Showing 18 changed files with 1,767 additions and 1,558 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ simple*

*.csv
.idea/
.vscode
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.15.0] - 2018-11-14
### Added
- Hot reload [#73](https://github.com/plotly/dash-renderer/pull/73)

## [0.14.3] - 2018-10-11
### Fixed
- Included missing polyfills to restore Internet Explorer support [#87](https://github.com/plotly/dash-renderer/issues/87)

## [0.14.2] - 2018-10-11
### Fixed
- Upgraded dependencies to remove warnings
- Restored whatgw-fetch [#87](https://github.com/plotly/dash-renderer/issues/87)
- Restored whatwg-fetch [#87](https://github.com/plotly/dash-renderer/issues/87)
### Added
- Prettier support
- Better ESLint configs
Expand Down
2,919 changes: 1,471 additions & 1,448 deletions dash_renderer/dash_renderer.dev.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dash_renderer/dash_renderer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_renderer/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.14.3'
__version__ = '0.15.0'
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dash_core_components==0.33.0
dash_html_components==0.11.0rc5
dash==0.28.0
dash==0.29.0
percy
selenium
mock
Expand Down
20 changes: 18 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-renderer",
"version": "0.14.3",
"version": "0.15.0",
"description": "render dash components in react",
"main": "src/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/AppContainer.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import APIController from './APIController.react';
import DocumentTitle from './components/core/DocumentTitle.react';
import Loading from './components/core/Loading.react';
import Toolbar from './components/core/Toolbar.react';
import Reloader from './components/core/Reloader.react';

function UnconnectedAppContainer() {
return (
Expand All @@ -14,6 +15,7 @@ function UnconnectedAppContainer() {
<APIController />
<DocumentTitle />
<Loading />
<Reloader />
</div>
</Authentication>
);
Expand Down
4 changes: 4 additions & 0 deletions src/actions/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ export function login(oauth_token) {
Authorization: `Bearer ${oauth_token}`,
});
}

export function getReloadHash() {
return apiThunk('_reload-hash', 'GET', 'reloadRequest');
}
18 changes: 8 additions & 10 deletions src/components/core/DocumentTitle.react.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* global document:true */

import {connect} from 'react-redux'
import {any} from 'ramda'
import {Component} from 'react'
import {connect} from 'react-redux';
import {any} from 'ramda';
import {Component} from 'react';
import PropTypes from 'prop-types';

class DocumentTitle extends Component {
constructor(props) {
super(props);
this.state = {
initialTitle: document.title
initialTitle: document.title,
};
}

Expand All @@ -31,11 +31,9 @@ class DocumentTitle extends Component {
}

DocumentTitle.propTypes = {
requestQueue: PropTypes.array.isRequired
requestQueue: PropTypes.array.isRequired,
};

export default connect(
state => ({
requestQueue: state.requestQueue
})
)(DocumentTitle);
export default connect(state => ({
requestQueue: state.requestQueue,
}))(DocumentTitle);
25 changes: 10 additions & 15 deletions src/components/core/Loading.react.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import {connect} from 'react-redux'
import {any} from 'ramda'
import React from 'react'
import {connect} from 'react-redux';
import {any} from 'ramda';
import React from 'react';
import PropTypes from 'prop-types';

function Loading(props) {
if (any(r => r.status === 'loading', props.requestQueue)) {
return (
<div className="_dash-loading-callback"/>
);
}
return null;

return <div className="_dash-loading-callback" />;
}
return null;
}

Loading.propTypes = {
requestQueue: PropTypes.array.isRequired
requestQueue: PropTypes.array.isRequired,
};

export default connect(
state => ({
requestQueue: state.requestQueue
})
)(Loading);
export default connect(state => ({
requestQueue: state.requestQueue,
}))(Loading);
49 changes: 24 additions & 25 deletions src/components/core/NotifyObservers.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import PropTypes from 'prop-types';
* its child as a prop
*/

function mapStateToProps (state) {
function mapStateToProps(state) {
return {
dependencies: state.dependenciesRequest.content,
paths: state.paths
paths: state.paths,
};
}

function mapDispatchToProps (dispatch) {
function mapDispatchToProps(dispatch) {
return {dispatch};
}

Expand All @@ -37,40 +37,40 @@ function mergeProps(stateProps, dispatchProps, ownProps) {
const payload = {
props: newProps,
id: ownProps.id,
itempath: stateProps.paths[ownProps.id]
itempath: stateProps.paths[ownProps.id],
};

// Update this component's props
dispatch(updateProps(payload));

// Update output components that depend on this input
dispatch(notifyObservers({id: ownProps.id, props: newProps}));
}
}

},
};
}

function NotifyObserversComponent ({
function NotifyObserversComponent({
children,
id,
paths,

dependencies,

fireEvent,
setProps
setProps,
}) {
const thisComponentTriggersEvents = (
dependencies && dependencies.find(dependency => (
const thisComponentTriggersEvents =
dependencies &&
dependencies.find(dependency =>
dependency.events.find(event => event.id === id)
))
);
const thisComponentSharesState = (
dependencies && dependencies.find(dependency => (
dependency.inputs.find(input => input.id === id) ||
dependency.state.find(state => state.id === id)
))
);
);
const thisComponentSharesState =
dependencies &&
dependencies.find(
dependency =>
dependency.inputs.find(input => input.id === id) ||
dependency.state.find(state => state.id === id)
);
/*
* Only pass in `setProps` and `fireEvent` if they are actually
* necessary.
Expand All @@ -87,8 +87,8 @@ function NotifyObserversComponent ({
* or `subscribed_properties` instead of `fireEvent` and `setProps`.
*/
const extraProps = {};
if (thisComponentSharesState &&

if (
thisComponentSharesState &&
// there is a bug with graphs right now where
// the restyle listener gets assigned with a
// setProps function that was created before
Expand All @@ -104,15 +104,14 @@ function NotifyObserversComponent ({

if (!isEmpty(extraProps)) {
return React.cloneElement(children, extraProps);
}
return children;

}
return children;
}

NotifyObserversComponent.propTypes = {
id: PropTypes.string.isRequired,
children: PropTypes.node.isRequired,
path: PropTypes.array.isRequired
path: PropTypes.array.isRequired,
};

export default connect(
Expand Down
Loading

0 comments on commit a38da62

Please sign in to comment.