Skip to content

Commit

Permalink
Merge pull request #925 from rainlanguage/2024-10-08-trades-table-tim…
Browse files Browse the repository at this point in the history
…e-picker-fix

Update trades list table on order details
  • Loading branch information
thedavidmeister authored Oct 17, 2024
2 parents dbab21d + 1a5e141 commit b6b39b5
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions tauri-app/src/lib/components/tables/OrderTradesListTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,26 @@
$: orderTradesQuery = createInfiniteQuery({
queryKey: [id, QKEY_ORDER_TRADES_LIST + id],
queryFn: ({ pageParam }: { pageParam: number }) => {
return orderTradesList(
id,
$subgraphUrl || '',
pageParam,
undefined,
startTimestamp,
endTimestamp,
);
queryFn: async ({ pageParam }: { pageParam: number }) => {
tradesCount = undefined;
const [count, trades] = await Promise.all([
orderTradesCount(id, $subgraphUrl || '', startTimestamp, endTimestamp),
orderTradesList(id, $subgraphUrl || '', pageParam, undefined, startTimestamp, endTimestamp),
]);
if (typeof count === 'number') {
tradesCount = count;
}
return trades;
},
initialPageParam: 0,
getNextPageParam: (lastPage: Trade[], _allPages: Trade[][], lastPageParam: number) => {
return lastPage.length === DEFAULT_PAGE_SIZE ? lastPageParam + 1 : undefined;
},
enabled: !!$subgraphUrl,
});
$: $orderTradesQuery.isFetching || $orderTradesQuery.isLoading,
orderTradesCount(id, $subgraphUrl || '', startTimestamp, endTimestamp)
.then((v) => (typeof v === 'number' ? (tradesCount = v) : (tradesCount = undefined)))
.catch(() => (tradesCount = undefined));
</script>

<TanstackAppTable query={orderTradesQuery} emptyMessage="No trades found" rowHoverable={false}>
Expand Down

0 comments on commit b6b39b5

Please sign in to comment.