@@ -60,10 +60,7 @@ import { ListItem } from '../../components/ListItem';
6060import { TabPageHeader } from '../../components/TabPageHeader' ;
6161import useAppNavigation from '../../hooks/useAppNavigation' ;
6262import { usePromiseResult } from '../../hooks/usePromiseResult' ;
63- import {
64- useAccountSelectorActions ,
65- useActiveAccount ,
66- } from '../../states/jotai/contexts/accountSelector' ;
63+ import { useActiveAccount } from '../../states/jotai/contexts/accountSelector' ;
6764import { useEarnActions , useEarnAtom } from '../../states/jotai/contexts/earn' ;
6865
6966import { EARN_PAGE_MAX_WIDTH , EARN_RIGHT_PANEL_WIDTH } from './EarnConfig' ;
@@ -712,9 +709,6 @@ function BasicEarnHome() {
712709 run : refreshOverViewData ,
713710 } = usePromiseResult (
714711 async ( ) => {
715- if ( ! account && ! indexedAccount ) {
716- return ;
717- }
718712 const totalFiatMapKey = actions . current . buildEarnAccountsKey ( {
719713 accountId : account ?. id ,
720714 indexAccountId : indexedAccount ?. id ,
@@ -850,7 +844,6 @@ function BasicEarnHome() {
850844 ] ;
851845
852846 const navigation = useAppNavigation ( ) ;
853- const accountSelectorActions = useAccountSelectorActions ( ) ;
854847
855848 const onBannerPress = useCallback (
856849 async ( {
@@ -867,49 +860,40 @@ function BasicEarnHome() {
867860 useSystemBrowser : boolean ;
868861 theme ?: 'light' | 'dark' ;
869862 } ) => {
870- if ( account || indexedAccount ) {
871- if ( href . includes ( '/earn/staking' ) ) {
872- const [ path , query ] = href . split ( '?' ) ;
873- const paths = path . split ( '/' ) ;
874- const provider = paths . pop ( ) ;
875- const symbol = paths . pop ( ) ;
876- const params = new URLSearchParams ( query ) ;
877- const networkId = params . get ( 'networkId' ) ;
878- const vault = params . get ( 'vault' ) ;
879- if ( provider && symbol && networkId ) {
880- const earnAccount =
881- await backgroundApiProxy . serviceStaking . getEarnAccount ( {
882- indexedAccountId : indexedAccount ?. id ,
883- accountId : account ?. id ?? '' ,
884- networkId,
885- } ) ;
886- void EarnNavigation . pushDetailPageFromDeeplink ( navigation , {
887- accountId : earnAccount ?. accountId || account ?. id || '' ,
888- indexedAccountId :
889- earnAccount ?. account . indexedAccountId || indexedAccount ?. id ,
890- provider,
891- symbol,
863+ if ( href . includes ( '/earn/staking' ) ) {
864+ const [ path , query ] = href . split ( '?' ) ;
865+ const paths = path . split ( '/' ) ;
866+ const provider = paths . pop ( ) ;
867+ const symbol = paths . pop ( ) ;
868+ const params = new URLSearchParams ( query ) ;
869+ const networkId = params . get ( 'networkId' ) ;
870+ const vault = params . get ( 'vault' ) ;
871+ if ( provider && symbol && networkId ) {
872+ const earnAccount =
873+ await backgroundApiProxy . serviceStaking . getEarnAccount ( {
874+ indexedAccountId : indexedAccount ?. id ,
875+ accountId : account ?. id ?? '' ,
892876 networkId,
893- vault : vault ?? '' ,
894877 } ) ;
895- }
896- return ;
897- }
898- if ( hrefType === 'external' ) {
899- openUrlExternal ( href ) ;
900- } else {
901- openUrlInApp ( href ) ;
878+ void EarnNavigation . pushDetailPageFromDeeplink ( navigation , {
879+ accountId : earnAccount ?. accountId || account ?. id || '' ,
880+ indexedAccountId :
881+ earnAccount ?. account . indexedAccountId || indexedAccount ?. id ,
882+ provider,
883+ symbol,
884+ networkId,
885+ vault : vault ?? '' ,
886+ } ) ;
902887 }
888+ return ;
889+ }
890+ if ( hrefType === 'external' ) {
891+ openUrlExternal ( href ) ;
903892 } else {
904- await accountSelectorActions . current . showAccountSelector ( {
905- navigation,
906- activeWallet : undefined ,
907- num : 0 ,
908- sceneName : EAccountSelectorSceneName . home ,
909- } ) ;
893+ openUrlInApp ( href ) ;
910894 }
911895 } ,
912- [ account , accountSelectorActions , indexedAccount , navigation ] ,
896+ [ account , indexedAccount , navigation ] ,
913897 ) ;
914898
915899 const banners = useMemo ( ( ) => {
0 commit comments