Skip to content

Commit

Permalink
fix: wallet tab index error (#3336)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwang1113 authored Aug 1, 2023
1 parent 358fb2a commit e437fb6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/kit/src/views/Wallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
import RefreshLightningNetworkToken from '@onekeyhq/kit/src/views/LightningNetwork/RefreshLightningNetworkToken';
import { MAX_PAGE_CONTAINER_WIDTH } from '@onekeyhq/shared/src/config/appConfig';
import { isLightningNetworkByNetworkId } from '@onekeyhq/shared/src/engine/engineConsts';
import debugLogger from '@onekeyhq/shared/src/logger/debugLogger';
import platformEnv from '@onekeyhq/shared/src/platformEnv';

import backgroundApiProxy from '../../background/instance/backgroundApiProxy';
Expand Down Expand Up @@ -163,8 +164,10 @@ const WalletTabs: FC = () => {
);

const getHomeTabIndex = useCallback(
(tabName: string | undefined) =>
usedTabs.findIndex((tab) => tab.name === tabName),
(tabName: string | undefined) => {
const index = usedTabs.findIndex((tab) => tab.name === tabName);
return index === -1 ? 0 : index;
},
[usedTabs],
);

Expand All @@ -179,6 +182,7 @@ const WalletTabs: FC = () => {

// Android animation redux causes ui stuttering
timer.current = setTimeout(() => {
debugLogger.common.info('setHomeTabIndex', index);
backgroundApiProxy.dispatch(
setHomeTabName(getHomeTabNameByIndex(index)),
);
Expand Down

0 comments on commit e437fb6

Please sign in to comment.