Skip to content

Commit 1748b5d

Browse files
authored
fix(suite): display loading Skeleton instead of jumping search and add account button when suite is running discovery (#17299)
1 parent 130e2a9 commit 1748b5d

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsMenu.tsx

+15-7
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import React from 'react';
22

33
import styled from 'styled-components';
44

5+
import { DiscoveryStatus } from '@suite-common/wallet-constants';
56
import { selectSelectedDevice } from '@suite-common/wallet-core';
67
import { getFailedAccounts, sortByCoin } from '@suite-common/wallet-utils';
7-
import { Column, Row, useScrollShadow } from '@trezor/components';
8+
import { Column, Row, SkeletonRectangle, useScrollShadow } from '@trezor/components';
89
import { spacings, spacingsPx, zIndices } from '@trezor/theme';
910

1011
import { Translation } from 'src/components/suite';
@@ -47,6 +48,7 @@ export const AccountsMenu = () => {
4748
const { scrollElementRef, onScroll, ShadowTop, ShadowBottom, ShadowContainer } =
4849
useScrollShadow();
4950
const isSidebarCollapsed = useIsSidebarCollapsed();
51+
const isDiscoveryRunning = discovery?.status === DiscoveryStatus.RUNNING;
5052

5153
if (!device || !discovery) {
5254
if (isSidebarCollapsed) return <Wrapper />;
@@ -71,12 +73,18 @@ export const AccountsMenu = () => {
7173
<Header>
7274
<ExpandedSidebarOnly>
7375
<Row justifyContent="space-between" gap={spacings.xs}>
74-
{!isEmpty && <AccountSearchBox />}
75-
<AddAccountButton
76-
isFullWidth={isEmpty}
77-
data-testid="@account-menu/add-account"
78-
device={device}
79-
/>
76+
{isDiscoveryRunning ? (
77+
<SkeletonRectangle animate width="100%" height={38} />
78+
) : (
79+
<>
80+
{!isEmpty && <AccountSearchBox />}
81+
<AddAccountButton
82+
isFullWidth={isEmpty}
83+
data-testid="@account-menu/add-account"
84+
device={device}
85+
/>
86+
</>
87+
)}
8088
</Row>
8189
<CoinsFilter />
8290
</ExpandedSidebarOnly>

0 commit comments

Comments
 (0)