fix for reducerUtils.observeChanges

pull/89/head
Szymon Lesisz 6 years ago
parent f0e0b4fee2
commit e3816be8d2

@ -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) {

@ -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;
}
}

Loading…
Cancel
Save