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

Commit a38da62

Browse files
authored
Merge pull request #73 from plotly/hot-reload
Hot reload
2 parents b1cfc99 + cabf3e3 commit a38da62

18 files changed

+1767
-1558
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ simple*
1919

2020
*.csv
2121
.idea/
22+
.vscode

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [0.15.0] - 2018-11-14
6+
### Added
7+
- Hot reload [#73](https://github.com/plotly/dash-renderer/pull/73)
8+
59
## [0.14.3] - 2018-10-11
610
### Fixed
711
- Included missing polyfills to restore Internet Explorer support [#87](https://github.com/plotly/dash-renderer/issues/87)
812

913
## [0.14.2] - 2018-10-11
1014
### Fixed
1115
- Upgraded dependencies to remove warnings
12-
- Restored whatgw-fetch [#87](https://github.com/plotly/dash-renderer/issues/87)
16+
- Restored whatwg-fetch [#87](https://github.com/plotly/dash-renderer/issues/87)
1317
### Added
1418
- Prettier support
1519
- Better ESLint configs

dash_renderer/dash_renderer.dev.js

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

dash_renderer/dash_renderer.min.js

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

dash_renderer/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.14.3'
1+
__version__ = '0.15.0'

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dash_core_components==0.33.0
22
dash_html_components==0.11.0rc5
3-
dash==0.28.0
3+
dash==0.29.0
44
percy
55
selenium
66
mock

package-lock.json

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

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": "0.14.3",
3+
"version": "0.15.0",
44
"description": "render dash components in react",
55
"main": "src/index.js",
66
"scripts": {

src/AppContainer.react.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import APIController from './APIController.react';
55
import DocumentTitle from './components/core/DocumentTitle.react';
66
import Loading from './components/core/Loading.react';
77
import Toolbar from './components/core/Toolbar.react';
8+
import Reloader from './components/core/Reloader.react';
89

910
function UnconnectedAppContainer() {
1011
return (
@@ -14,6 +15,7 @@ function UnconnectedAppContainer() {
1415
<APIController />
1516
<DocumentTitle />
1617
<Loading />
18+
<Reloader />
1719
</div>
1820
</Authentication>
1921
);

src/actions/api.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,7 @@ export function login(oauth_token) {
9696
Authorization: `Bearer ${oauth_token}`,
9797
});
9898
}
99+
100+
export function getReloadHash() {
101+
return apiThunk('_reload-hash', 'GET', 'reloadRequest');
102+
}

src/components/core/DocumentTitle.react.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/* global document:true */
22

3-
import {connect} from 'react-redux'
4-
import {any} from 'ramda'
5-
import {Component} from 'react'
3+
import {connect} from 'react-redux';
4+
import {any} from 'ramda';
5+
import {Component} from 'react';
66
import PropTypes from 'prop-types';
77

88
class DocumentTitle extends Component {
99
constructor(props) {
1010
super(props);
1111
this.state = {
12-
initialTitle: document.title
12+
initialTitle: document.title,
1313
};
1414
}
1515

@@ -31,11 +31,9 @@ class DocumentTitle extends Component {
3131
}
3232

3333
DocumentTitle.propTypes = {
34-
requestQueue: PropTypes.array.isRequired
34+
requestQueue: PropTypes.array.isRequired,
3535
};
3636

37-
export default connect(
38-
state => ({
39-
requestQueue: state.requestQueue
40-
})
41-
)(DocumentTitle);
37+
export default connect(state => ({
38+
requestQueue: state.requestQueue,
39+
}))(DocumentTitle);

src/components/core/Loading.react.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
1-
import {connect} from 'react-redux'
2-
import {any} from 'ramda'
3-
import React from 'react'
1+
import {connect} from 'react-redux';
2+
import {any} from 'ramda';
3+
import React from 'react';
44
import PropTypes from 'prop-types';
55

66
function Loading(props) {
77
if (any(r => r.status === 'loading', props.requestQueue)) {
8-
return (
9-
<div className="_dash-loading-callback"/>
10-
);
11-
}
12-
return null;
13-
8+
return <div className="_dash-loading-callback" />;
9+
}
10+
return null;
1411
}
1512

1613
Loading.propTypes = {
17-
requestQueue: PropTypes.array.isRequired
14+
requestQueue: PropTypes.array.isRequired,
1815
};
1916

20-
export default connect(
21-
state => ({
22-
requestQueue: state.requestQueue
23-
})
24-
)(Loading);
17+
export default connect(state => ({
18+
requestQueue: state.requestQueue,
19+
}))(Loading);

src/components/core/NotifyObservers.react.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import PropTypes from 'prop-types';
99
* its child as a prop
1010
*/
1111

12-
function mapStateToProps (state) {
12+
function mapStateToProps(state) {
1313
return {
1414
dependencies: state.dependenciesRequest.content,
15-
paths: state.paths
15+
paths: state.paths,
1616
};
1717
}
1818

19-
function mapDispatchToProps (dispatch) {
19+
function mapDispatchToProps(dispatch) {
2020
return {dispatch};
2121
}
2222

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

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

4646
// Update output components that depend on this input
4747
dispatch(notifyObservers({id: ownProps.id, props: newProps}));
48-
}
49-
}
50-
48+
},
49+
};
5150
}
5251

53-
function NotifyObserversComponent ({
52+
function NotifyObserversComponent({
5453
children,
5554
id,
5655
paths,
5756

5857
dependencies,
5958

6059
fireEvent,
61-
setProps
60+
setProps,
6261
}) {
63-
const thisComponentTriggersEvents = (
64-
dependencies && dependencies.find(dependency => (
62+
const thisComponentTriggersEvents =
63+
dependencies &&
64+
dependencies.find(dependency =>
6565
dependency.events.find(event => event.id === id)
66-
))
67-
);
68-
const thisComponentSharesState = (
69-
dependencies && dependencies.find(dependency => (
70-
dependency.inputs.find(input => input.id === id) ||
71-
dependency.state.find(state => state.id === id)
72-
))
73-
);
66+
);
67+
const thisComponentSharesState =
68+
dependencies &&
69+
dependencies.find(
70+
dependency =>
71+
dependency.inputs.find(input => input.id === id) ||
72+
dependency.state.find(state => state.id === id)
73+
);
7474
/*
7575
* Only pass in `setProps` and `fireEvent` if they are actually
7676
* necessary.
@@ -87,8 +87,8 @@ function NotifyObserversComponent ({
8787
* or `subscribed_properties` instead of `fireEvent` and `setProps`.
8888
*/
8989
const extraProps = {};
90-
if (thisComponentSharesState &&
91-
90+
if (
91+
thisComponentSharesState &&
9292
// there is a bug with graphs right now where
9393
// the restyle listener gets assigned with a
9494
// setProps function that was created before
@@ -104,15 +104,14 @@ function NotifyObserversComponent ({
104104

105105
if (!isEmpty(extraProps)) {
106106
return React.cloneElement(children, extraProps);
107-
}
108-
return children;
109-
107+
}
108+
return children;
110109
}
111110

112111
NotifyObserversComponent.propTypes = {
113112
id: PropTypes.string.isRequired,
114113
children: PropTypes.node.isRequired,
115-
path: PropTypes.array.isRequired
114+
path: PropTypes.array.isRequired,
116115
};
117116

118117
export default connect(

0 commit comments

Comments
 (0)