Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Handle mergeble entry after adding
Browse files Browse the repository at this point in the history
fix #3368

auditor: @bridiver
  • Loading branch information
darkdh committed Aug 24, 2016
1 parent 2ea50f4 commit eeadfc2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,13 @@ const handleAppAction = (action) => {
appState.getIn(['autofill', 'addresses']).filterNot((address) => {
return Immutable.is(address, action.originalDetail.get('guid'))
}))
if (action.originalDetail.get('guid') !== undefined) {
Filtering.removeAutofillAddress(action.originalDetail.get('guid').toJS())
}

let addresses = appState.getIn(['autofill', 'addresses'])
const guid = Filtering.addAutofillAddress(action.detail.toJS())
if (action.originalDetail.get('guid') !== undefined &&
!Immutable.is(Immutable.fromJS(guid), action.originalDetail.get('guid'))) {
Filtering.removeAutofillAddress(action.originalDetail.get('guid').toJS())
}
appState = appState.setIn(['autofill', 'addresses'], addresses.push(Immutable.fromJS(guid)))
break
}
Expand All @@ -581,12 +582,13 @@ const handleAppAction = (action) => {
appState.getIn(['autofill', 'creditCards']).filterNot((card) => {
return Immutable.is(card, action.originalDetail.get('guid'))
}))
if (action.originalDetail.get('guid') !== undefined) {
Filtering.removeAutofillCreditCard(action.originalDetail.get('guid').toJS())
}

let creditCards = appState.getIn(['autofill', 'creditCards'])
const guid = Filtering.addAutofillCreditCard(action.detail.toJS())
if (action.originalDetail.get('guid') !== undefined &&
!Immutable.is(Immutable.fromJS(guid), action.originalDetail.get('guid'))) {
Filtering.removeAutofillCreditCard(action.originalDetail.get('guid').toJS())
}
appState = appState.setIn(['autofill', 'creditCards'], creditCards.push(Immutable.fromJS(guid)))
break
}
Expand Down

0 comments on commit eeadfc2

Please sign in to comment.