1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-25 00:18:07 +00:00

fix for reducerUtils.observeChanges

This commit is contained in:
Szymon Lesisz 2018-09-26 19:45:22 +02:00
parent f0e0b4fee2
commit e3816be8d2
2 changed files with 1 additions and 2 deletions

View File

@ -185,7 +185,6 @@ export const observe = (prevState: State, action: Action): AsyncAction => async
const status = getAccountStatus(state, newState);
newState.notification = status || null;
newState.shouldRender = status ? status.shouldRender : true;
// check if newState is different than previous state
const stateChanged = reducerUtils.observeChanges(prevState.selectedAccount, newState, ['location', 'account', 'network', 'discovery', 'tokens', 'pending', 'notification', 'shouldRender']);
if (stateChanged) {

View File

@ -128,7 +128,7 @@ export const observeChanges = (prev: ?(Object | Array<any>), current: ?(Object |
if (prev instanceof Object && current instanceof Object) {
for (let i = 0; i < fields.length; i++) {
const key = fields[i];
if (Array.isArray(prev[key]) && Array.isArray(current[key])) return prev[key].length !== current[key].length;
if (Array.isArray(prev[key]) && Array.isArray(current[key]) && prev[key].length !== current[key].length) return true;
if (prev[key] !== current[key]) return true;
}
}