1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Fix refetch data token orders (#700)

* refetch token orders inside getJobs

* removed logs

* don't use Time component for Finished column if date is undefined

* removed logs

Co-authored-by: Norbi <katunanorbert@gmai.com>
This commit is contained in:
Norbi 2021-06-28 12:47:56 +03:00 committed by GitHub
parent 31ee1aab98
commit c81a986261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,11 @@ const columns = [
{ {
name: 'Finished', name: 'Finished',
selector: function getTimeRow(row: ComputeJobMetaData) { selector: function getTimeRow(row: ComputeJobMetaData) {
return <Time date={row.dateFinished} isUnix relative /> return row.dateFinished ? (
<Time date={row.dateFinished} isUnix relative />
) : (
''
)
} }
}, },
{ {
@ -103,7 +107,7 @@ export default function ComputeJobs(): ReactElement {
const { accountId } = useWeb3() const { accountId } = useWeb3()
const [isLoading, setIsLoading] = useState(true) const [isLoading, setIsLoading] = useState(true)
const [jobs, setJobs] = useState<ComputeJobMetaData[]>([]) const [jobs, setJobs] = useState<ComputeJobMetaData[]>([])
const { data } = useQuery<ComputeOrders>(getComputeOrders, { const { data, refetch } = useQuery<ComputeOrders>(getComputeOrders, {
variables: { variables: {
user: accountId?.toLowerCase() user: accountId?.toLowerCase()
} }
@ -114,6 +118,7 @@ export default function ComputeJobs(): ReactElement {
setIsLoading(true) setIsLoading(true)
await refetch()
const dtList = [] const dtList = []
const computeJobs: ComputeJobMetaData[] = [] const computeJobs: ComputeJobMetaData[] = []
for (let i = 0; i < data.tokenOrders.length; i++) { for (let i = 0; i < data.tokenOrders.length; i++) {