mirror of
https://github.com/ascribe/onion.git
synced 2025-01-08 20:55:59 +01:00
Fix bug in polling
This commit is contained in:
parent
a31fe76926
commit
0065c3d792
@ -19,8 +19,11 @@ let EditionContainer = React.createClass({
|
|||||||
|
|
||||||
onChange(state) {
|
onChange(state) {
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
let isEncoding = state.edition.digital_work ? state.edition.digital_work.isEncoding : null;
|
if (!state.edition.digital_work) {
|
||||||
if (typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
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);
|
let timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
|
||||||
this.setState({timerId: timerId});
|
this.setState({timerId: timerId});
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,11 @@ let PieceContainer = React.createClass({
|
|||||||
|
|
||||||
onChange(state) {
|
onChange(state) {
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
let isEncoding = state.piece.digital_work ? state.piece.digital_work.isEncoding : null;
|
if (!state.piece.digital_work) {
|
||||||
if (typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
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);
|
let timerId = window.setInterval(() => PieceActions.fetchOne(this.props.params.pieceId), 10000);
|
||||||
this.setState({timerId: timerId});
|
this.setState({timerId: timerId});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user