1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Fix bug in polling

This commit is contained in:
vrde 2015-07-15 18:00:43 +02:00
parent a31fe76926
commit 0065c3d792
2 changed files with 10 additions and 4 deletions

View File

@ -19,8 +19,11 @@ let EditionContainer = React.createClass({
onChange(state) {
this.setState(state);
let isEncoding = state.edition.digital_work ? state.edition.digital_work.isEncoding : null;
if (typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
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});
}

View File

@ -21,8 +21,11 @@ let PieceContainer = React.createClass({
onChange(state) {
this.setState(state);
let isEncoding = state.piece.digital_work ? state.piece.digital_work.isEncoding : null;
if (typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
if (!state.piece.digital_work) {
return;
}
let isEncoding = state.piece.digital_work.isEncoding;
if (state.piece.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
let timerId = window.setInterval(() => PieceActions.fetchOne(this.props.params.pieceId), 10000);
this.setState({timerId: timerId});
}