-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix: Rendering error for threshold and alignment of help icons #3585
Fix: Rendering error for threshold and alignment of help icons #3585
Conversation
While working on this task, I found out the threshold percentage doesn't seem to be working in my dev env. I spend most of yesterday and today investigating and trying to test the threshold progress bar in my local env and in QA but this has been difficult to test because of how time works in those environments. In some cases, I had a full progress bar 100% and in others I had nothing. Would it be possible when any of you review this PR to test if you can get the threshold progress bar showing any other number than 100%? Thank you! |
@@ -42,12 +42,13 @@ const ProgressBar = ({ | |||
}: Props) => { | |||
const { formatMessage } = useIntl(); | |||
const titleText = formatMessage(MSG.titleProgress, { value, max }); | |||
const shouldDisplayThreshold = !!(threshold && threshold > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!!threshold
would have the same effect here. If threshold
is falsy (e.g. undefined
or 0
) it will return false
, otherwise true
. Then you could remove this line and below do !!threshold && (...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I was keeping the threshold inside a variable because generally I like to use variable names to help document the code but in this case its simple enough that it isn't necessary. Thank you for the suggestion. I made the change already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice alignment of the question marks. I have left a comment re the boolean logic.
As an aside to this issue, I'm curious to know if anybody else had trouble trying to test the voting mechanism? I found the experience error-prone (either receiving errors or unexpected behaviour). For example, I received the following error on multiple occasions, as well as the voting phase itself going straight to reveal, despite my not having voted.
I can document more extensively if this is something others have noticed also.
Yes, please. I am not getting the same error as you. However, sometimes I get something similar if the reputation miner is on but as soon as I toggle it off the staking or objection works for me. |
The alignment and Something fishy is definitely happening with the threshold and progress percentage thought. For me, they remain @willm30 @Julianahlk You are staking a motion, which is something that changes the user's balance, while having the monitor ON. The monitor then fast-forwards a few days into the future, making the staking period or even the motion instantly finish because all the timers ran out. This is why you can't stake, or why the voting phase goes straight to revealing (voting phase timer ran out). So basically, I recommend turning the monitor off when you want to work with motions in order to avoid wacky shit like this hahaha :) |
@ArmandoGraterol Do you know how to test to get a threshold other than 0? I wasn't able to test this in QA either and I figured my dev environment wasn't setup correctly for this type of test. Would it be possible to test in Production? I can create a new issue but wanted to be clear on the correct repro steps for this issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good, except there's two more question mark icons that are mis-aligned.
Here's a basic outline to follow in order to test this properly (and not run into the revert transaction that Will was running into)
- Toggle mining on: http://0.0.0.0:3001/reputation/monitor/toggle
- Create 1st user and a colony
- mint tokens
- payout 10 tokens to 1st user
- log out
- log in, create 2nd user and join the colony
- log out
- log back in with the 1st user
- pay the 10 tokens to the same user
- initialize voting reputation
- enable voting reputation
- Toggle mining off: http://0.0.0.0:3001/reputation/monitor/toggle
- refresh app
By this point, you'll have a colony, with voting reputation enabled, and 2 users, each having 50% of the reputation in said colony
If you need to pass time manually, just use this from the command line:
curl -X POST --data '{"jsonrpc":"2.0","method":"evm_increaseTime","params":[3600],"id":1}' localhost:8545
curl -X POST --data '{"jsonrpc":"2.0","method":"evm_mine","params":[],"id":1}' localhost:8545
I tried to get a different threshold and it seems like it's not working as expected. By following the steps Raul outlined, and leaving the default extension settings you should be able to test if the threshold and progress bar display works or not, and right now it seems like it's not working properly because when you vote with 1 user the progress remains in 0 as if nobody voted. |
Agreed! I did the same test and still I cannot get the progress bar to change. If you hardcode the threshold number it will actually display the threshold percentage in the progress bar but without that nothing works so far. As mentioned above, I will open a new issue for the progress bar to investigate further. Thank you guys! |
1bd5b3c
to
fd21775
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Raul!
Oh man! Did realize 😅 I will remember for next time to not do that. |
fd21775
to
e41511b
Compare
Description
This PR fixes the issue with a 0 rendering error for the threshold progress bar. As well as the alignment of the help icons in the
VoteDetails
component.##Story
The threshold value was 0, so when it was being evaluated it kept returning a 0 in the tsx and rendered by React to the screen. In this situation, it is better to use a boolean.
Figma link
Before
Changes 🏗
Removed unnecessary divs in the
VoteDetails
component that were causing the issue with the misalignment of the help icons.Created a new variable that would handle the threshold as a boolean instead of a number.
After
TODO
Resolves #3572