diff --git a/app/components/transaction-details.js b/app/components/transaction-details.js index 9f6fad9..aff6d21 100644 --- a/app/components/transaction-details.js +++ b/app/components/transaction-details.js @@ -188,7 +188,13 @@ export const TransactionDetailsComponent = ({ diff --git a/app/containers/transactions.js b/app/containers/transactions.js index 85e1c74..a6d3a78 100644 --- a/app/containers/transactions.js +++ b/app/containers/transactions.js @@ -3,6 +3,7 @@ import eres from 'eres'; import { connect } from 'react-redux'; import { BigNumber } from 'bignumber.js'; +import uuidv4 from 'uuid/v4'; import { TransactionsView } from '../views/transactions'; import { @@ -64,7 +65,7 @@ const mapDispatchToProps = (dispatch: Dispatch): MapDispatchToProps => ({ ...transactions, ...listShieldedTransactions({ count, offset: shieldedTransactionsCount }), ].map(transaction => ({ - transactionId: transaction.txid ? transaction.txid : null, + transactionId: transaction.txid ? transaction.txid : uuidv4(), type: transaction.category, date: new Date(transaction.time * 1000).toISOString(), address: transaction.address, diff --git a/app/redux/modules/transactions.js b/app/redux/modules/transactions.js index 103de8d..701e978 100644 --- a/app/redux/modules/transactions.js +++ b/app/redux/modules/transactions.js @@ -1,5 +1,5 @@ // @flow -import uniq from 'lodash.uniq'; +import uniqBy from 'lodash.uniqby'; import type { Action } from '../../types/redux'; import type { Transaction } from '../../components/transaction-item'; @@ -72,7 +72,7 @@ export default (state: State = initialState, action: Action) => { return { ...state, ...action.payload, - list: uniq(state.list.concat(action.payload.list)), + list: uniqBy(state.list.concat(action.payload.list), tr => tr.transactionId + tr.type), isLoading: false, error: null, }; diff --git a/flow-custom-typedefs/uniq-by.js b/flow-custom-typedefs/uniq-by.js new file mode 100644 index 0000000..7cdeacf --- /dev/null +++ b/flow-custom-typedefs/uniq-by.js @@ -0,0 +1,3 @@ +declare module 'lodash.uniqby' { + declare module.exports: (arr: T[], (T) => $Values) => T[]; +} diff --git a/package.json b/package.json index e766bcb..f1fb3eb 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "history": "^4.7.2", "lodash.flow": "^3.5.0", "lodash.groupby": "^4.6.0", - "lodash.uniq": "^4.5.0", + "lodash.uniqby": "^4.7.0", "p-queue": "^3.0.0", "process-exists": "^3.1.0", "qrcode.react": "^0.8.0", diff --git a/yarn.lock b/yarn.lock index ee7207a..afaffc2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9238,6 +9238,11 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= +lodash.uniqby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302" + integrity sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI= + "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.1.0, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0, lodash@^4.8.0, lodash@~4.17.10: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"