Skip to content

Commit

Permalink
fix: update sorting function for assets list
Browse files Browse the repository at this point in the history
  • Loading branch information
akhlopiachyi committed Jan 19, 2024
1 parent 2bbf9e6 commit 0c7110b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/web-coreum/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web-coreum",
"version": "2.19.3-74",
"version": "2.19.3-75",
"license": "Apache-2.0",
"private": true,
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const fetchColumns = (): {
},
{
key: 'name',
sortKey: 'denom',
sortKey: 'display',
width: 20,
sort: true,
},
Expand Down
9 changes: 7 additions & 2 deletions packages/ui/src/screens/assets/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,13 @@ export const useAssets = () => {

if (state.sortKey && state.sortDirection) {
sorted.sort((a, b) => {
let compareA = R.pathOr('', [...state.sortKey.split('.')], a);
let compareB = R.pathOr('', [...state.sortKey.split('.')], b);
let compareA: string | number = R.pathOr('', [...state.sortKey.split('.')], a);
let compareB: string | number = R.pathOr('', [...state.sortKey.split('.')], b);

if (state.sortKey === 'supply' || state.sortKey === 'holders') {
compareA = +compareA;
compareB = +compareB;
}

if (typeof compareA === 'string' && typeof compareB === 'string') {
compareA = compareA.toLowerCase();
Expand Down

0 comments on commit 0c7110b

Please sign in to comment.