mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +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) {
|
||||
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});
|
||||
}
|
||||
|
@ -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});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user