fix(vote): proper vote data sequencing

This commit is contained in:
Alexey Kasyanchuk
2018-04-18 18:54:56 +03:00
parent 5e02b0df73
commit f23310065d
6 changed files with 175 additions and 205 deletions

View File

@ -20,7 +20,6 @@ import LinearProgress from 'material-ui/LinearProgress';
import FlatButton from 'material-ui/FlatButton';
import {fileTypeDetect} from './content'
import {contentIcon} from './torrent'
import waitObject from './waitObject'
let buildFilesTree = (filesList) => {
let rootTree = {
@ -231,8 +230,8 @@ export default class TorrentPage extends Page {
if(this.props.hash != hash)
return;
// in some cases torrent object can be resolve late
await waitObject(this, 'torrent')
if(!this.torrent)
return
this.torrent.good = good;
this.torrent.bad = bad;

View File

@ -1,15 +0,0 @@
export default (obj, val) => new Promise((resolve) => {
if(typeof obj[val] === 'object')
{
resolve()
return
}
const w = setInterval(() => {
if(typeof obj[val] === 'object')
{
clearInterval(w)
resolve()
}
}, 3)
})