diff --git a/src/components/Asset/AssetActions/AssetStats/index.tsx b/src/components/Asset/AssetActions/AssetStats/index.tsx index 0579fcbe0..dd6e79991 100644 --- a/src/components/Asset/AssetActions/AssetStats/index.tsx +++ b/src/components/Asset/AssetActions/AssetStats/index.tsx @@ -1,13 +1,23 @@ import { useAsset } from '@context/Asset' import { useUserPreferences } from '@context/UserPreferences' import { formatPrice } from '@shared/Price/PriceUnit' -import React from 'react' +import React, { useEffect, useState } from 'react' import styles from './index.module.css' export default function AssetStats() { const { locale } = useUserPreferences() const { asset } = useAsset() - const { orders, allocated } = asset.stats + const [orders, setOrders] = useState(0) + const [allocated, setAllocated] = useState(0) + + useEffect(() => { + if (!asset) return + + const { orders, allocated } = asset.stats + + setOrders(orders) + setAllocated(allocated) + }, [asset]) return (