WA-234 Fix unnecesary re-renders when storing again just fetched safe
This commit is contained in:
parent
161b0976ba
commit
1e51a48250
|
@ -18,7 +18,9 @@ class SafeView extends React.PureComponent<Props> {
|
||||||
if (!safe) { return }
|
if (!safe) { return }
|
||||||
const safeAddress: string = safe.get('address')
|
const safeAddress: string = safe.get('address')
|
||||||
fetchBalance(safeAddress)
|
fetchBalance(safeAddress)
|
||||||
|
if (safe) {
|
||||||
fetchSafe(safe)
|
fetchSafe(safe)
|
||||||
|
}
|
||||||
}, 1500)
|
}, 1500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ action: AddSafeType
|
||||||
|
|
||||||
export default handleActions({
|
export default handleActions({
|
||||||
[UPDATE_SAFE]: (state: State, action: ActionType<typeof updateSafe>): State =>
|
[UPDATE_SAFE]: (state: State, action: ActionType<typeof updateSafe>): State =>
|
||||||
state.set(action.payload.get('address'), action.payload),
|
state.update(action.payload.get('address'), prevSafe =>
|
||||||
|
(prevSafe.equals(action.payload) ? prevSafe : action.payload)),
|
||||||
[UPDATE_SAFES]: (state: State, action: ActionType<typeof updateSafes>): State =>
|
[UPDATE_SAFES]: (state: State, action: ActionType<typeof updateSafes>): State =>
|
||||||
action.payload,
|
action.payload,
|
||||||
[ADD_SAFE]: (state: State, action: ActionType<typeof addSafe>): State => {
|
[ADD_SAFE]: (state: State, action: ActionType<typeof addSafe>): State => {
|
||||||
|
|
|
@ -75,7 +75,9 @@ export const safeSelector: Selector<GlobalState, RouterProps, SafeSelectorProps>
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
return safes.get(address)
|
const safe = safes.get(address)
|
||||||
|
|
||||||
|
return safe
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue