Skip to content

Commit 5810cbb

Browse files
committed
feat: remove empty current wallet handler from the main view
and add the handler in the callback of init function
1 parent 476a918 commit 5810cbb

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

  • packages/neuron-ui/src

packages/neuron-ui/src/containers/Main/hooks.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ import {
2222
Command as CommandSubject,
2323
} from 'services/subjects'
2424
import { ckbCore, getTipBlockNumber, getBlockchainInfo } from 'services/chain'
25-
import { Routes, ConnectionStatus } from 'utils/const'
26-
import { WalletWizardPath } from 'components/WalletWizard'
25+
import { ConnectionStatus } from 'utils/const'
2726
import {
2827
networks as networksCache,
2928
currentNetworkID as currentNetworkIDCache,
@@ -102,7 +101,6 @@ export const useOnCurrentWalletChange = ({
102101
if (walletID) {
103102
initAppState()(dispatch, history)
104103
} else {
105-
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
106104
initAppState()(dispatch, history)
107105
}
108106
}, [walletID, dispatch, history])

packages/neuron-ui/src/states/stateProvider/actionCreators/app.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const initAppState = () => (dispatch: StateDispatch, history: any) => {
1818
transactionList: true,
1919
},
2020
})
21-
setTimeout(() => {})
2221
getNeuronWalletState()
2322
.then(res => {
2423
if (res.status) {
@@ -39,6 +38,9 @@ export const initAppState = () => (dispatch: StateDispatch, history: any) => {
3938
type: NeuronWalletActions.UpdateTransactionList,
4039
payload: transactions,
4140
})
41+
if (!wallet) {
42+
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
43+
}
4244

4345
currentWalletCache.save(wallet)
4446
walletsCache.save(wallets)
@@ -47,6 +49,9 @@ export const initAppState = () => (dispatch: StateDispatch, history: any) => {
4749
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
4850
}
4951
})
52+
.catch(() => {
53+
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
54+
})
5055
.finally(() => {
5156
dispatch({
5257
type: AppActions.UpdateLoadings,

0 commit comments

Comments
 (0)