Fix show token balances after sending out all tokens (#1521)

This commit is contained in:
Daniel Sanchez 2020-10-26 11:34:53 +01:00 committed by GitHub
parent 1c53167a9a
commit 95d102d337
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -84,7 +84,7 @@ export const buildSafe = async (
currentVersion: currentVersion ?? '',
needsUpdate,
featuresEnabled,
balances: Map(),
balances: localSafe?.balances || Map(),
latestIncomingTxBlock: 0,
activeAssets: Set(),
activeTokens: Set(),

View File

@ -39,7 +39,7 @@ const makeSafe = Record<SafeRecordProps>({
activeAssets: Set(),
blacklistedTokens: Set(),
blacklistedAssets: Set(),
balances: Map({}),
balances: Map(),
nonce: 0,
latestIncomingTxBlock: 0,
recurringUser: undefined,

View File

@ -53,8 +53,9 @@ const updateSafeProps = (prevSafe, safe) => {
// We check each safe property sent in action.payload
safeProperties.forEach((key) => {
if (safe[key] && typeof safe[key] === 'object') {
if (safe[key].length >= 0) {
// If type is array we update the array
if (safe[key].length >= 0 || Map.isMap(safe[key])) {
// If type is array we replace it
// If type is Immutable Map we replace it
record.update(key, () => safe[key])
} else if (safe[key].size >= 0) {
// If type is Immutable List we replace current List
@ -108,7 +109,7 @@ export default handleActions(
return state.updateIn(
['safes', safe.address],
makeSafe({ name: 'LOADED SAFE', address: safe.address }),
makeSafe({ name: safe?.name || 'LOADED SAFE', address: safe.address }),
(prevSafe) => updateSafeProps(prevSafe, safe),
)
},