Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix: ensure activity items correctly sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Mar 29, 2020
1 parent 5fa4ba9 commit e96a8d5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 39 deletions.
4 changes: 2 additions & 2 deletions renderer/reducers/activity/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ function createActivityPaginator() {
const { transactions } = await grpc.services.Lightning.getTransactions()
return { items: transactions, offset: 0 }
}
const getTimestamp = item => item.timeStamp || item.settleDate || item.creationDate
const getTimestamp = item =>
parseInt(item.timeStamp, 10) || parseInt(item.settleDate, 10) || parseInt(item.creationDate, 10)
const itemSorter = (a, b) => getTimestamp(b) - getTimestamp(a)
return combinePaginators(itemSorter, fetchInvoices, fetchPayments, fetchTransactions)
}
Expand All @@ -222,7 +223,6 @@ export const loadNextPage = () => async (dispatch, getState) => {
const thisPaginator = getPaginator()
if (activitySelectors.hasNextPage(getState())) {
const { items, hasNextPage } = await thisPaginator(config.activity.pageSize)

const getItemType = item => {
if (item.destAddresses) {
return 'transactions'
Expand Down
16 changes: 0 additions & 16 deletions renderer/reducers/invoice.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createSelector } from 'reselect'
import uniqBy from 'lodash/uniqBy'
import config from 'config'
import createReducer from '@zap/utils/createReducer'
import { showSystemNotification } from '@zap/utils/notifications'
import { convert } from '@zap/utils/btc'
Expand Down Expand Up @@ -120,21 +119,6 @@ export function sendInvoice() {
}
}

/**
* fetchInvoices - Fetch details of all invoices.
*
* @returns {object} Action
*/
export const fetchInvoices = ({
maxInvoices = config.activity.pageSize,
} = {}) => async dispatch => {
dispatch(getInvoices())
const { invoices } = await grpc.services.Lightning.listInvoices({
numMaxInvoices: maxInvoices,
})
dispatch(receiveInvoices(invoices))
}

/**
* receiveInvoices - Receive details of all invoice.
*
Expand Down
21 changes: 0 additions & 21 deletions renderer/reducers/payment/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ const initialState = {
// Actions
// ------------------------------------

/**
* getPayments - Initiate fetching all payments.
*
* @returns {object} Action
*/
export function getPayments() {
return {
type: GET_PAYMENTS,
}
}
/**
* receivePayments - Fetch payments success callback.
*
Expand Down Expand Up @@ -112,17 +102,6 @@ export const sendPayment = data => dispatch => {
})
}

/**
* fetchPayments - Fetch details of all lightning payments.
*
* @returns {Function} Thunk
*/
export const fetchPayments = () => async dispatch => {
dispatch(getPayments())
const { payments } = await grpc.services.Lightning.listPayments()
dispatch(receivePayments(payments))
}

/**
* updatePayment - Updates specified payment request.
*
Expand Down

0 comments on commit e96a8d5

Please sign in to comment.