Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple render #20

Open
Dhruv1107 opened this issue Feb 8, 2019 · 7 comments
Open

Multiple render #20

Dhruv1107 opened this issue Feb 8, 2019 · 7 comments

Comments

@Dhruv1107
Copy link

What is the solution for multiple rendering? When i add a new account and reload the page the list of candidates is showing multiple times. I have tried modifying listenForEvents in app.js, but nothing seems to work.
capture2

@DtzMan
Copy link

DtzMan commented Apr 2, 2019

same problem for me too

@moseley
Copy link

moseley commented May 17, 2019

See Issue #2

@pchavan150
Copy link

change this
fromBlock: 0,
toBlock: 'latest'
to
fromBlock: 'latest',
toBlock: 'latest'

in app.js file

@9w6nuu
Copy link

9w6nuu commented May 20, 2020

change this
fromBlock: 0,
toBlock: 'latest'
to
fromBlock: 'latest',
toBlock: 'latest'

in app.js file

I did. something changed.
but still I have some issue here.
this time it shows not multiple but 2 times

loadWeb3: async function() { if(window.ethereum) { window.web3 = new Web3(window.ethereum); await ethereum.enable(); } else if(window.web3){ window.web3 = new Web3(web3.currentProvider); } else{ window.alert('Non-Ethereum brower detected. You should consider trying MetaMask!'); } return App.initContract(); },
is this because i changed this too?
in app.js line 40
initContract: function() { $.getJSON("Election.json", function(election) { App.contracts.Election = TruffleContract(election); App.contracts.Election.setProvider(web3.currentProvider); App.listenForEvents(); return App.render(); }); },

@pchavan150
Copy link

change this
fromBlock: 0,
toBlock: 'latest'
to
fromBlock: 'latest',
toBlock: 'latest'
in app.js file

I did. something changed.
but still I have some issue here.
this time it shows not multiple but 2 times

loadWeb3: async function() { if(window.ethereum) { window.web3 = new Web3(window.ethereum); await ethereum.enable(); } else if(window.web3){ window.web3 = new Web3(web3.currentProvider); } else{ window.alert('Non-Ethereum brower detected. You should consider trying MetaMask!'); } return App.initContract(); },
is this because i changed this too?
in app.js line 40
initContract: function() { $.getJSON("Election.json", function(election) { App.contracts.Election = TruffleContract(election); App.contracts.Election.setProvider(web3.currentProvider); App.listenForEvents(); return App.render(); }); },

Yes I faced too so I removed event section...so it solved everything

@Jadhoo
Copy link

Jadhoo commented Jun 2, 2020

change this
fromBlock: 0,
toBlock: 'latest'
to
fromBlock: 'latest',
toBlock: 'latest'
in app.js file

I did. something changed.
but still I have some issue here.
this time it shows not multiple but 2 times
loadWeb3: async function() { if(window.ethereum) { window.web3 = new Web3(window.ethereum); await ethereum.enable(); } else if(window.web3){ window.web3 = new Web3(web3.currentProvider); } else{ window.alert('Non-Ethereum brower detected. You should consider trying MetaMask!'); } return App.initContract(); },
is this because i changed this too?
in app.js line 40
initContract: function() { $.getJSON("Election.json", function(election) { App.contracts.Election = TruffleContract(election); App.contracts.Election.setProvider(web3.currentProvider); App.listenForEvents(); return App.render(); }); },

Yes I faced too so I removed event section...so it solved everything

Yeah, removing the votedEvent in Election.sol solved the issue, but while performing 'truffle test', it fails to pass the 3rd condition👇

  1. allows a voter to cast a vote

@DLanzafamedelRio
Copy link

So it actually works without any problems:
instance.votedEvent({}, { fromBlock: 'latest', toBlock: 'latest' + 1 }).watch(function(error, event) {...});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants