fix premature 50 block no confirm error

add full refresh due to new off by one error
This commit is contained in:
Barry Gitarts 2018-07-17 12:02:17 -04:00
parent 84694d1dd2
commit c47908a454
3 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import React, { Fragment, PureComponent } from 'react';
import { toString } from 'lodash';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Card from '@material-ui/core/Card';
@ -79,7 +80,7 @@ class Poll extends PureComponent {
const { value } = this.state;
const { toWei } = web3.utils;
const balance4Voting = toWei(value * value);
const balance4Voting = toWei(toString(value * value));
const toSend = balance4Voting == 0 ? unvote(idPoll) : customVote(idPoll, balance4Voting);
toSend.estimateGas()

View File

@ -57,11 +57,14 @@ class App extends React.Component {
}
updatePoll = async (idPoll) => {
const { poll } = PollManager.methods;
const { poll, nPolls } = PollManager.methods;
const { rawPolls } = this.state;
const npolls = await nPolls().call();
// This check needs to be done because of a bug in web3
if (npolls !== rawPolls.length) return this._getPolls();
const newPolls = [...rawPolls];
const updatedPoll = await poll(idPoll).call();
newPolls[idPoll] = updatedPoll;
newPolls[idPoll] = { ...updatedPoll };
this.setState({ rawPolls: newPolls });
}

View File

@ -10,7 +10,7 @@
"buildDir": "dist/",
"config": "config/",
"versions": {
"web3": "1.0.0-beta",
"web3": "1.0.0-beta.34",
"solc": "0.4.24",
"ipfs-api": "17.2.4"
},