From e3816be8d2f2ca5600e7fabeead3023a78cb9aaa Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 26 Sep 2018 19:45:22 +0200 Subject: [PATCH] fix for reducerUtils.observeChanges --- src/actions/SelectedAccountActions.js | 1 - src/reducers/utils/index.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/actions/SelectedAccountActions.js b/src/actions/SelectedAccountActions.js index 02826e00..f10d1414 100644 --- a/src/actions/SelectedAccountActions.js +++ b/src/actions/SelectedAccountActions.js @@ -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) { diff --git a/src/reducers/utils/index.js b/src/reducers/utils/index.js index c8b8d56f..8a3ded63 100644 --- a/src/reducers/utils/index.js +++ b/src/reducers/utils/index.js @@ -128,7 +128,7 @@ export const observeChanges = (prev: ?(Object | Array), 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; } }