Witness Voting Page Improvements

in #utopian-io6 years ago (edited)

Repository

https://github.com/steemit/condenser

Description of Problem

Original issue: https://github.com/steemit/condenser/issues/1610

Witness voting page did not display property after casting votes. The linked issue had a video demonstrating the problem, where it had a consistent reproduction of a case where the user unvoted a witness, but the vote remained on the page. Only when refreshing the page would it correctly disappear.

The Fix

Pull request: https://github.com/steemit/condenser/pull/2859

After a bunch of debugging, the cause was that the flow for the process of voting for witness involved the sequence:

  1. Remove witness vote from local state, to reflect in browser immediately.
  2. Broadcast vote to steem node.
  3. If the broadcast failed, restore state to pre-vote state.

The problem was that as part of step (2) above, it did a re-fetch of the user, and my guess here is that the node had not reflected latest state, and returned the votes back with the witness still populated. The fix involves a re-ordering:

  1. Broadcast vote to steem node. (Still do the fetch of the user from steem node).
  2. On success, remove witness vote from local state to reflect in browser. On failure, restore state to pre-vote state.

Additional Changes

The fix also added spinners to indicate that the vote was in progress. This works in the top 50 list as well as in the write-in list, on adding the vote and on removing the vote.

Here's a sample:

witnessspinner.PNG

(Yes, if you ever stumble upon my witness voting history, I've been repeatedly voting and unvoting the inactive witness while testing this out)

When you do write-ins, while it's in the progress of voting it will show up with a spinner. And when you deactivate a write-in, it will show a spinner and remove after the vote is cast.

GitHub Account

https://github.com/eonwarped

Sort:  

great post! hilarious re: upvoting and downvoting witnesses, i didn't even know we could do that. always posting good stuff E!!!

ops thanks for catching that. changed to voting/unvoting ;)

ohhh oops i didnt know it was a mistake🤣🤣🤣
thought it was a new feature 👽👽👽

You are always doing something good for the platform, would you consider working for Steem devs part time hahaha

I guess this kind of counts lol ;)

Thanks for the contribution, @eonwarped! Great fix and great work - keep it up!

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 19 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

I upvoted your contribution because to my mind your post is at least 15 SBD worth and should receive 74 votes. It's now up to the lovely Steemit community to make this come true.

I am TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!

Have a nice day and sincerely yours,
trufflepig
TrufflePig

Hey @eonwarped
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.28
TRX 0.13
JST 0.032
BTC 60947.53
ETH 2913.40
USDT 1.00
SBD 3.56