1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

propagate UPDATE_SELECTED_ACCOUNT only if needed

This commit is contained in:
Szymon Lesisz 2018-05-29 11:51:02 +02:00
parent 726a41fb8c
commit f3ccc617f5

View File

@ -82,9 +82,15 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct
let needUpdate: boolean = false; let needUpdate: boolean = false;
Object.keys(payload).forEach((key) => { Object.keys(payload).forEach((key) => {
if (Array.isArray(payload[key])) {
if (Array.isArray(state.selectedAccount[key]) && payload[key].length !== state.selectedAccount[key].length) {
needUpdate = true;
}
} else {
if (payload[key] !== state.selectedAccount[key]) { if (payload[key] !== state.selectedAccount[key]) {
needUpdate = true; needUpdate = true;
} }
}
}) })
if (needUpdate) { if (needUpdate) {