mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-25 16:05:25 +00:00
Fixs race condition when loading collectibles (#855)
This commit is contained in:
parent
78d4f7ebfd
commit
c6233a3fee
@ -2,7 +2,6 @@
|
||||
|
||||
import type { Dispatch as ReduxDispatch } from 'redux'
|
||||
|
||||
import fetchCollectibles from '~/logic/collectibles/store/actions/fetchCollectibles'
|
||||
import { nftAssetsSelector } from '~/logic/collectibles/store/selectors'
|
||||
import updateActiveAssets from '~/routes/safe/store/actions/updateActiveAssets'
|
||||
import {
|
||||
@ -24,7 +23,6 @@ const activateAssetsByBalance = (safeAddress: string) => async (
|
||||
return
|
||||
}
|
||||
|
||||
await dispatch(fetchCollectibles())
|
||||
const availableAssets = nftAssetsSelector(state)
|
||||
const alreadyActiveAssets = safeActiveAssetsSelectorBySafe(safeAddress, safes)
|
||||
const blacklistedAssets = safeBlacklistedAssetsSelectorBySafe(safeAddress, safes)
|
||||
|
@ -2,6 +2,7 @@
|
||||
import { useMemo } from 'react'
|
||||
import { batch, useDispatch, useSelector } from 'react-redux'
|
||||
|
||||
import fetchCollectibles from '~/logic/collectibles/store/actions/fetchCollectibles'
|
||||
import { fetchCurrencyValues } from '~/logic/currencyValues/store/actions/fetchCurrencyValues'
|
||||
import activateAssetsByBalance from '~/logic/tokens/store/actions/activateAssetsByBalance'
|
||||
import fetchSafeTokens from '~/logic/tokens/store/actions/fetchSafeTokens'
|
||||
@ -24,7 +25,11 @@ export const useFetchTokens = () => {
|
||||
}
|
||||
|
||||
if (COLLECTIBLES_LOCATION_REGEX.test(history.location.pathname)) {
|
||||
dispatch(activateAssetsByBalance(address))
|
||||
batch(() => {
|
||||
dispatch(fetchCollectibles()).then(() => {
|
||||
dispatch(activateAssetsByBalance(address))
|
||||
})
|
||||
})
|
||||
}
|
||||
}, [history.location.pathname])
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user