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

fix: display the selected validator #8626

Merged
merged 4 commits into from
Dec 13, 2024
Merged

Conversation

qperrot
Copy link
Contributor

@qperrot qperrot commented Dec 6, 2024

βœ… Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • ...

πŸ“ 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


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@qperrot qperrot requested a review from a team as a code owner December 6, 2024 10:23
Copy link

vercel bot commented Dec 6, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
web-tools βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Dec 12, 2024 3:32pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 3:32pm
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 3:32pm
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 3:32pm

@live-github-bot live-github-bot bot added the desktop Has changes in LLD label Dec 6, 2024
Copy link
Contributor

@sprohaszka-ledger sprohaszka-ledger left a 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);
Copy link
Contributor

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))
Copy link
Contributor

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.

@live-github-bot
Copy link
Contributor

live-github-bot bot commented Dec 11, 2024

Mobile Bundle Checks

Comparing 9f7c91c against 4b8e87d.

βœ… Previous issues have all been fixed.

Desktop Bundle Checks

Comparing 9f7c91c against 4b8e87d.

Copy link
Contributor

@sprohaszka-ledger sprohaszka-ledger left a 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 πŸ€”

@sprohaszka-ledger sprohaszka-ledger self-requested a review December 12, 2024 14:46
Copy link
Contributor

@sprohaszka-ledger sprohaszka-ledger left a 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

@qperrot qperrot merged commit 4941eec into develop Dec 13, 2024
53 checks passed
@qperrot qperrot deleted the bugfix/ada-staking-delegation branch December 13, 2024 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop Has changes in LLD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants