Browse Source

console.warn in case we try to add twice same account

fixme: this should never happen but i've been able to do it. this check is to be removed in the future
master
Gaëtan Renaudeau 7 years ago
parent
commit
6bbe243dca
  1. 8
      src/reducers/accounts.js

8
src/reducers/accounts.js

@ -34,7 +34,13 @@ const handlers: Object = {
ADD_ACCOUNT: (
state: AccountsState,
{ payload: account }: { payload: Account },
): AccountsState => [...state, orderAccountsOperations(account)],
): AccountsState => {
if (state.some(a => a.id === account.id)) {
console.warn('ADD_ACCOUNT attempt for an account that already exists!', account.id)
return state
}
return [...state, orderAccountsOperations(account)]
},
UPDATE_ACCOUNT: (
state: AccountsState,

Loading…
Cancel
Save