diff --git a/.changeset/warm-rules-tie.md b/.changeset/warm-rules-tie.md
new file mode 100644
index 00000000000..d73b94084b7
--- /dev/null
+++ b/.changeset/warm-rules-tie.md
@@ -0,0 +1,5 @@
+---
+"ledger-live-desktop": patch
+---
+
+fix cvs wrong value
diff --git a/apps/ledger-live-desktop/src/renderer/components/TokenRow.tsx b/apps/ledger-live-desktop/src/renderer/components/TokenRow.tsx
index e0f5d864fb9..dbdc3264ff6 100644
--- a/apps/ledger-live-desktop/src/renderer/components/TokenRow.tsx
+++ b/apps/ledger-live-desktop/src/renderer/components/TokenRow.tsx
@@ -1,7 +1,7 @@
import React from "react";
import Box from "~/renderer/components/Box";
import { Account, AccountLike, PortfolioRange } from "@ledgerhq/types-live";
-import { getMainAccount } from "@ledgerhq/live-common/account/index";
+import { getAccountCurrency } from "@ledgerhq/live-common/account/index";
import styled from "styled-components";
import Header from "~/renderer/screens/accounts/AccountRowItem/Header";
import Balance from "~/renderer/screens/accounts/AccountRowItem/Balance";
@@ -10,7 +10,6 @@ import Countervalue from "~/renderer/screens/accounts/AccountRowItem/Countervalu
import Star from "~/renderer/components/Stars/Star";
import { TableRow } from "./TableContainer";
import { useAccountUnit } from "../hooks/useAccountUnit";
-
type Props = {
account: AccountLike;
nested?: boolean;
@@ -19,7 +18,6 @@ type Props = {
onClick: (b: AccountLike, a: Account) => void;
range: PortfolioRange;
};
-
const NestedRow = styled(Box)`
flex: 1;
font-weight: 600;
@@ -38,17 +36,12 @@ const NestedRow = styled(Box)`
background: ${p => p.theme.colors.palette.action.hover};
}
`;
-
function TokenRow(props: Props) {
const { account, parentAccount, onClick, range, nested, disableRounding } = props;
-
const onClickRow = () => onClick(account, parentAccount);
-
- const mainAccount = getMainAccount(account, parentAccount);
const unit = useAccountUnit(account);
- const currency = mainAccount.currency;
+ const currency = getAccountCurrency(account);
const Row = nested ? NestedRow : TableRow;
-
return (
@@ -59,5 +52,4 @@ function TokenRow(props: Props) {
);
}
-
export default React.memo(TokenRow);
diff --git a/apps/ledger-live-desktop/src/renderer/screens/accounts/AccountRowItem/index.tsx b/apps/ledger-live-desktop/src/renderer/screens/accounts/AccountRowItem/index.tsx
index 19dede71e75..4043f68de72 100644
--- a/apps/ledger-live-desktop/src/renderer/screens/accounts/AccountRowItem/index.tsx
+++ b/apps/ledger-live-desktop/src/renderer/screens/accounts/AccountRowItem/index.tsx
@@ -24,7 +24,6 @@ import { useAccountUnit } from "~/renderer/hooks/useAccountUnit";
import { getDefaultAccountName } from "@ledgerhq/live-wallet/accountName";
import { walletSelector } from "~/renderer/reducers/wallet";
import { accountNameSelector } from "@ledgerhq/live-wallet/store";
-
const Row = styled(Box)`
background: ${p => p.theme.colors.palette.background.paper};
border-radius: 4px;
@@ -97,14 +96,12 @@ const TokenShowMoreIndicator = styled(Button)<{ expanded?: boolean }>`
height: 32px;
text-align: center;
padding: 0;
-
&:hover ${Text} {
text-decoration: underline;
}
&:hover {
background-color: initial;
}
-
> :nth-child(2) {
margin-left: 8px;
transform: rotate(${p => (p.expanded ? "180deg" : "0deg")});
@@ -127,16 +124,13 @@ type Props = {
range: PortfolioRange;
search?: string;
};
-
const expandedStates: {
[key: string]: boolean;
} = {};
const AccountRowItem = (props: Props) => {
const { account, parentAccount, range, hidden, onClick, disableRounding, search } = props;
-
const walletState = useSelector(walletSelector);
const blacklistedTokenIds = useSelector(blacklistedTokenIdsSelector);
-
const [expanded, setExpanded] = useState(
account.type === "Account" && account.subAccounts
? expandedStates[account.id] || !!search
@@ -145,31 +139,24 @@ const AccountRowItem = (props: Props) => {
const scrollTopFocusRef = useRef(null);
- const mountedRef = useRef(true);
-
useEffect(() => {
- if (mountedRef.current) {
- mountedRef.current = false;
- return;
- }
+ setExpanded(!!search);
+ }, [search]);
+
+ const toggleAccordion = (e: SyntheticEvent) => {
+ e.stopPropagation();
+ expandedStates[account.id] = !expandedStates[account.id];
+ setExpanded(expandedStates[account.id]);
if (scrollTopFocusRef.current && !expanded) {
scrollTopFocusRef.current.scrollIntoView({
block: "nearest",
behavior: "smooth",
});
}
- }, [expanded]);
-
- const toggleAccordion = (e: SyntheticEvent) => {
- e.stopPropagation();
- expandedStates[account.id] = !expandedStates[account.id];
- setExpanded(expandedStates[account.id]);
};
const onClickHandler = () => onClick(account, parentAccount);
-
const unit = useAccountUnit(account);
-
let currency;
let mainAccount: Account | null | undefined;
let tokens;
@@ -177,13 +164,11 @@ const AccountRowItem = (props: Props) => {
let isToken;
if (account.type !== "Account") {
currency = account.token;
-
mainAccount = parentAccount;
isToken = mainAccount && listTokenTypesForCryptoCurrency(mainAccount.currency).length > 0;
if (!mainAccount) return null;
} else {
currency = account.currency;
-
mainAccount = account;
tokens = listSubAccounts(account).filter(
subAccount => !blacklistedTokenIds.includes(getAccountCurrency(subAccount).id),
@@ -211,7 +196,6 @@ const AccountRowItem = (props: Props) => {
const key = `${account.id}`;
const accountName =
accountNameSelector(walletState, { accountId: account.id }) || getDefaultAccountName(account);
-
return (
0 ? "has-tokens" : ""}`}