update selectedMarket on group reload

This commit is contained in:
tjs 2023-02-14 22:56:44 -05:00
parent 7f6352d418
commit d304045b16
1 changed files with 4 additions and 5 deletions

View File

@ -634,9 +634,9 @@ const mangoStore = create<MangoStore>()(
'9Y8paZ5wUpzLFfQuHz8j2RtPrKsDtHx9sbgFmWb5abCw'
)
const defaultMarket =
const selectedMarket =
serumMarkets.find((m) => m.name === selectedMarketName) ||
perpMarkets.find((m) => m.name === selectedMarketName)
perpMarkets.find((m) => m.name === selectedMarketName) ||
serumMarkets[0]
set((state) => {
@ -644,8 +644,7 @@ const mangoStore = create<MangoStore>()(
state.groupLoaded = true
state.serumMarkets = serumMarkets
state.perpMarkets = perpMarkets
state.selectedMarket.current =
state.selectedMarket.current || defaultMarket
state.selectedMarket.current = selectedMarket
if (!state.swap.inputBank && !state.swap.outputBank) {
state.swap.inputBank = inputBank
state.swap.outputBank = outputBank