-
Notifications
You must be signed in to change notification settings - Fork 27
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
Route to upgrade sub page based on token balance #66
Conversation
Preview uploaded to https://preview.dashboard.test.threshold.network/route-by-account-balance/index.html. |
Preview uploaded to https://preview.dashboard.test.threshold.network/route-by-account-balance/index.html. |
…nto route-by-account-balance
…nto route-by-account-balance
Preview uploaded to https://preview.dashboard.test.threshold.network/route-by-account-balance/index.html. |
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.
Hook redirects after successful upgrading KEEP/NU
to T
because the balances changes.
Scenario 1
- I have
KEEP
andNU
tokensKEEP balance > NU balance
- I upgraded
NU
toT
- dapp redirected me to the
upgrade/keep
^ There is the same issue when I have KEEP balance < NU balance
and want to upgrade from KEEP
to T
Scenario 2
- I have only
KEEP
.NU balance = 0
- I upgraded all my
KEEP
tokens toT
- dapp redirected me to the
upgrade/nu
I leave final approval to @Battenfield.
const isFirstRender = useRef(true) | ||
|
||
useEffect(() => { | ||
if (isFirstRender.current) { | ||
isFirstRender.current = false | ||
} |
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.
Looks like this flag is unnecessary because:
useEffect
will be triggered on first render,- a condition in the first
if
statement is met- we set theisFirstRender
tofalse
, - so in a second
if
statement the!isFirstRender.current
condition always betrue
Maybe I missed something but I tested locally and it looks like if(active)
is enough.
closing, as Chris asked for #77 instead |
No description provided.