1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

Move onChange() to after componentWillUnmount() for ESLint

This commit is contained in:
Brett Sun 2015-11-04 13:57:15 +01:00
parent 543605aae3
commit 2711c4ddb9

View File

@ -25,18 +25,6 @@ let EditionContainer = React.createClass({
return EditionStore.getState();
},
onChange(state) {
this.setState(state);
if (!state.edition.digital_work) {
return;
}
let isEncoding = state.edition.digital_work.isEncoding;
if (state.edition.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
let timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
this.setState({timerId: timerId});
}
},
componentDidMount() {
EditionStore.listen(this.onChange);
@ -62,6 +50,17 @@ let EditionContainer = React.createClass({
EditionStore.unlisten(this.onChange);
},
onChange(state) {
this.setState(state);
if (!state.edition.digital_work) {
return;
}
let isEncoding = state.edition.digital_work.isEncoding;
if (state.edition.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
let timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
this.setState({timerId: timerId});
}
},
loadEdition() {
EditionActions.fetchOne(this.props.params.editionId);