sort open orders by price (#356)

This commit is contained in:
saml33 2022-07-14 01:27:01 +10:00 committed by GitHub
parent 725920c90f
commit 8967598e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { useState } from 'react'
import { useMemo, useState } from 'react'
import { PencilIcon, TrashIcon, XIcon } from '@heroicons/react/solid'
import Link from 'next/link'
import { useRouter } from 'next/router'
@ -581,8 +581,12 @@ const OpenOrdersTable = () => {
}
}
const sortedOpenOrders = useMemo(() => {
return [...openOrders].sort((a, b) => b.price - a.price)
}, [openOrders])
const tableProps = {
openOrders,
openOrders: sortedOpenOrders,
cancelledOrderId: cancelId,
editOrderIndex,
handleCancelOrder,