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

Commit c108d1d

Browse files
committed
format prettier.
1 parent 28e67af commit c108d1d

File tree

9 files changed

+129
-123
lines changed

9 files changed

+129
-123
lines changed

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.

src/AppContainer.react.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import Loading from './components/core/Loading.react';
77
import Toolbar from './components/core/Toolbar.react';
88
import Reloader from './components/core/Reloader.react';
99

10-
1110
function UnconnectedAppContainer() {
1211
return (
1312
<Authentication>

src/actions/api.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,5 @@ export function login(oauth_token) {
9898
}
9999

100100
export function getReloadHash() {
101-
return apiThunk(
102-
'_reload-hash',
103-
'GET',
104-
'reloadRequest'
105-
)
101+
return apiThunk('_reload-hash', 'GET', 'reloadRequest');
106102
}

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(

src/components/core/Reloader.react.js

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
import R from 'ramda';
33
import React from 'react';
44
import PropTypes from 'prop-types';
5-
import {connect} from 'react-redux'
6-
import {getReloadHash} from "../../actions/api";
5+
import {connect} from 'react-redux';
6+
import {getReloadHash} from '../../actions/api';
77

88
class Reloader extends React.Component {
99
constructor(props) {
1010
super(props);
1111
if (props.config.hot_reload) {
12-
const { interval, max_retry } = props.config.hot_reload;
12+
const {interval, max_retry} = props.config.hot_reload;
1313
this.state = {
1414
hash: null,
1515
interval,
1616
disabled: false,
1717
intervalId: null,
1818
packages: null,
1919
max_retry: max_retry,
20-
}
20+
};
2121
} else {
2222
this.state = {
23-
disabled: true
24-
}
23+
disabled: true,
24+
};
2525
}
2626
this._retry = 0;
2727
this._head = document.querySelector('head');
@@ -33,15 +33,21 @@ class Reloader extends React.Component {
3333
if (this.state.hash === null) {
3434
this.setState({
3535
hash: reloadRequest.content.reloadHash,
36-
packages: reloadRequest.content.packages
36+
packages: reloadRequest.content.packages,
3737
});
3838
return;
3939
}
4040
if (reloadRequest.content.reloadHash !== this.state.hash) {
41-
if (reloadRequest.content.hard
42-
|| reloadRequest.content.packages.length !== this.state.packages.length
43-
|| !R.all(R.map(x => R.contains(x, this.state.packages),
44-
reloadRequest.content.packages))
41+
if (
42+
reloadRequest.content.hard ||
43+
reloadRequest.content.packages.length !==
44+
this.state.packages.length ||
45+
!R.all(
46+
R.map(
47+
x => R.contains(x, this.state.packages),
48+
reloadRequest.content.packages
49+
)
50+
)
4551
) {
4652
// Look if it was a css file.
4753
let was_css = false;
@@ -61,8 +67,9 @@ class Reloader extends React.Component {
6167
nodesToDisable.push(node);
6268
node = it.iterateNext();
6369
}
64-
nodesToDisable.forEach(
65-
n => n.setAttribute('disabled', 'disabled'));
70+
nodesToDisable.forEach(n =>
71+
n.setAttribute('disabled', 'disabled')
72+
);
6673

6774
const link = document.createElement('link');
6875
link.href = `${a.url}?m=${a.modified}`;
@@ -83,13 +90,13 @@ class Reloader extends React.Component {
8390
// Since it's only a css reload,
8491
// we just change the hash.
8592
this.setState({
86-
hash: reloadRequest.content.reloadHash
93+
hash: reloadRequest.content.reloadHash,
8794
});
8895
}
8996
} else {
9097
// Soft reload
9198
window.clearInterval(this.state.intervalId);
92-
dispatch({'type': 'RELOAD'});
99+
dispatch({type: 'RELOAD'});
93100
}
94101
}
95102
} else if (reloadRequest.status === 500) {
@@ -101,20 +108,20 @@ class Reloader extends React.Component {
101108
Reloader failed after ${this._retry} times.
102109
Please check your application for errors.
103110
`
104-
)
111+
);
105112
}
106113
this._retry++;
107114
}
108115
}
109116

110117
componentDidMount() {
111-
const { dispatch } = this.props;
112-
const { disabled, interval } = this.state;
118+
const {dispatch} = this.props;
119+
const {disabled, interval} = this.state;
113120
if (!disabled && !this.state.intervalId) {
114121
const intervalId = setInterval(() => {
115122
dispatch(getReloadHash());
116123
}, interval);
117-
this.setState({intervalId})
124+
this.setState({intervalId});
118125
}
119126
}
120127

@@ -146,4 +153,3 @@ export default connect(
146153
}),
147154
dispatch => ({dispatch})
148155
)(Reloader);
149-

0 commit comments

Comments
 (0)