Skip to content

Commit

Permalink
Merge pull request #6096 from LedgerHQ/bugfix/lld-accounts-order-afte…
Browse files Browse the repository at this point in the history
…r-settings-change

LLD - Fixed accounts order after changing countervalue in the settings
  • Loading branch information
cgrellard-ledger authored and jdabbech-ledger committed Feb 19, 2024
2 parents 0e6d604 + bc53750 commit b3f7ded
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-poems-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

LLD - Fixed accounts order after changing countervalue in the settings
16 changes: 7 additions & 9 deletions apps/ledger-live-desktop/src/renderer/screens/accounts/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import React, { useCallback } from "react";
import React, { useCallback, useMemo } from "react";
import { useSelector } from "react-redux";
import { useHistory } from "react-router-dom";
import styled from "styled-components";
import { Account, AccountLike } from "@ledgerhq/types-live";
import TrackPage, { setTrackingSource } from "~/renderer/analytics/TrackPage";
import Box from "~/renderer/components/Box";
import { Redirect } from "react-router";
import {
useFlattenSortAccounts,
useRefreshAccountsOrderingEffect,
} from "~/renderer/actions/general";
import { useFlattenSortAccounts } from "~/renderer/actions/general";
import { accountsSelector, starredAccountsSelector } from "~/renderer/reducers/accounts";
import { accountsViewModeSelector, selectedTimeRangeSelector } from "~/renderer/reducers/settings";
import AccountList from "./AccountList";
Expand All @@ -23,11 +20,12 @@ export default function AccountsPage() {
const flattenedAccounts = useFlattenSortAccounts({
enforceHideEmptySubAccounts: true,
});
const accounts = mode === "card" ? flattenedAccounts : rawAccounts;
const accounts = useMemo(
() => (mode === "card" ? flattenedAccounts : rawAccounts),
[mode, flattenedAccounts, rawAccounts],
);
const history = useHistory();
useRefreshAccountsOrderingEffect({
onMount: true,
});

const onAccountClick = useCallback(
(account: AccountLike, parentAccount?: Account | null) => {
setTrackingSource("accounts page");
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b3f7ded

Please sign in to comment.