reload account performance data for wallet change with no mango account

This commit is contained in:
saml33 2023-01-25 15:27:17 +11:00
parent 4e856695ff
commit 260b18fb95
1 changed files with 4 additions and 4 deletions

View File

@ -32,7 +32,7 @@ import {
ANIMATION_SETTINGS_KEY,
// IS_ONBOARDED_KEY
} from 'utils/constants'
// import { useWallet } from '@solana/wallet-adapter-react'
import { useWallet } from '@solana/wallet-adapter-react'
import useLocalStorageState from 'hooks/useLocalStorageState'
// import AccountOnboardingTour from '@components/tours/AccountOnboardingTour'
import dayjs from 'dayjs'
@ -44,7 +44,7 @@ import PnlHistoryModal from '@components/modals/PnlHistoryModal'
const AccountPage = () => {
const { t } = useTranslation(['common', 'account'])
// const { connected } = useWallet()
const { connected } = useWallet()
const { group } = useMangoGroup()
const { mangoAccount, mangoAccountAddress } = useMangoAccount()
const actions = mangoStore.getState().actions
@ -74,7 +74,7 @@ const AccountPage = () => {
)
useEffect(() => {
if (mangoAccountAddress) {
if (mangoAccountAddress || (connected && !mangoAccountAddress)) {
const set = mangoStore.getState().set
set((s) => {
s.mangoAccount.performance.initialLoad = false
@ -83,7 +83,7 @@ const AccountPage = () => {
actions.fetchAccountPerformance(mangoAccountAddress, 1)
actions.fetchAccountInterestTotals(mangoAccountAddress)
}
}, [actions, mangoAccountAddress])
}, [actions, connected, mangoAccountAddress])
useEffect(() => {
if (