fix balance table sorting crash
This commit is contained in:
parent
6c5711d6d9
commit
4b0cac5eb0
|
@ -12,7 +12,6 @@ export const buildOrderFieldFrom = (attr: string) => `${attr}Order`
|
|||
|
||||
const desc = (a: Object, b: Object, orderBy: string, orderProp: boolean) => {
|
||||
const order = orderProp ? buildOrderFieldFrom(orderBy) : orderBy
|
||||
console.log(a, b, orderBy, orderProp)
|
||||
|
||||
if (b[order] < a[order]) {
|
||||
return -1
|
||||
|
@ -25,13 +24,14 @@ const desc = (a: Object, b: Object, orderBy: string, orderProp: boolean) => {
|
|||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const stableSort = (dataArray: List<any>, cmp: any, fixed: boolean): Array<SortRow> => {
|
||||
export const stableSort = (dataArray: List<any>, cmp: any, fixed: boolean): List<any> => {
|
||||
const fixedElems: List<any> = fixed ? dataArray.filter((elem: any) => elem.fixed) : List([])
|
||||
const data: List<any> = fixed ? dataArray.filter((elem: any) => !elem[FIXED]) : dataArray
|
||||
const stabilizedThis = data.map((el, index) => [el, index])
|
||||
let stabilizedThis = data.map((el, index) => [el, index])
|
||||
|
||||
stabilizedThis.sort((a, b) => {
|
||||
stabilizedThis = stabilizedThis.sort((a, b) => {
|
||||
const order = cmp(a[0], b[0])
|
||||
|
||||
if (order !== 0) {
|
||||
return order
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ export const getBalanceData = (activeTokens: List<Token>): List<BalanceRow> => {
|
|||
export const generateColumns = () => {
|
||||
const assetColumn: Column = {
|
||||
id: BALANCE_TABLE_ASSET_ID,
|
||||
order: false,
|
||||
order: true,
|
||||
disablePadding: false,
|
||||
label: 'Asset',
|
||||
custom: false,
|
||||
|
|
Loading…
Reference in New Issue