-
Notifications
You must be signed in to change notification settings - Fork 357
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: display the selected validator #8626
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ
3 Skipped Deployments
|
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.
Try to keep logic inside coin-module, so we can add automated test more easily.
@@ -52,11 +47,20 @@ const ValidatorField = ({ account, delegation, onChangeValidator, selectedPoolId | |||
setLedgerPoolsLoading(true); | |||
fetchPoolDetails(account.currency, LEDGER_POOL_IDS) | |||
.then((apiRes: { pools: Array<StakePool> }) => { | |||
const filteredPool = apiRes.pools.filter(pool => pool.poolId === delegation?.poolId); |
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.
The best is to implement this logic in getPools.ts
file, coin-module Cardano. This way we can add an automated test to check the expected behaviour.
The method in the coin-module car return an Array so the UI call the setCurrentPool
without checking the answer.
<Box flex={1} py={3} alignItems="center" justifyContent="center"> | ||
<BigSpinner size={35} /> | ||
</Box> | ||
) : ( | ||
<ScrollLoadingList | ||
data={ | ||
showAll | ||
? pools.filter(p => !poolIdsToFilterFromAllPools.includes(p.poolId)) | ||
: ledgerPools | ||
? pools.filter(p => p && !poolIdsToFilterFromAllPools.includes(p.poolId)) |
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.
Optional:
Not sure that imbricated ternary is really readable.
Also, I think pools has always something or nothing, but no optional value (i.e. undefined
or null
), therefore ?
operator is unnecessary.
ca721e3
to
c8e1b38
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.
I am not sure to understand what is the logic you want to implement in the fetchPoolDetails
π€
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.
Not sure about the implementation of the fetchPoolDetails
β Checklist
npx changeset
was attached.π Description
Given a user who has an active delegation
When his wants to change the validator
Then clicking on βShow lessβ does not display the selected validator no the one currently delegating
Screen.Recording.2024-12-06.at.11.19.54.mov
β Context
LIVE-14500
π§ Checklist for the PR Reviewers