fix to set initialLoad state when loading margin account

This commit is contained in:
Tyler Shipe 2021-05-04 22:20:52 -04:00
parent 4f7e1b4990
commit a38752d792
1 changed files with 4 additions and 5 deletions

View File

@ -249,7 +249,6 @@ const useMangoStore = create<MangoStore>((set, get) => ({
if (marginAccounts.length > 0) { if (marginAccounts.length > 0) {
set((state) => { set((state) => {
state.marginAccounts = marginAccounts state.marginAccounts = marginAccounts
state.selectedMarginAccount.initialLoad = false
if (state.selectedMarginAccount.current) { if (state.selectedMarginAccount.current) {
state.selectedMarginAccount.current = marginAccounts.find( state.selectedMarginAccount.current = marginAccounts.find(
(ma) => (ma) =>
@ -262,12 +261,12 @@ const useMangoStore = create<MangoStore>((set, get) => ({
} }
}) })
} }
set((state) => {
state.selectedMarginAccount.initialLoad = false
})
}) })
.catch((err) => { .catch((err) => {
console.error( console.error('Could not get margin accounts for wallet', err)
'Could not get margin accounts for user in effect ',
err
)
}) })
}, },
async fetchAllMangoGroups() { async fetchAllMangoGroups() {