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

refetch price on network change

This commit is contained in:
Matthias Kretschmann 2020-08-10 15:08:37 +02:00
parent ac156d0ea0
commit fc7de43e16
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -3,7 +3,7 @@ import classNames from 'classnames/bind'
import PriceConversion from './Conversion'
import styles from './index.module.css'
import { formatCurrency } from '@coingecko/cryptoformat'
import { useMetadata } from '@oceanprotocol/react'
import { useMetadata, useOcean } from '@oceanprotocol/react'
import { DDO } from '@oceanprotocol/lib'
import Loader from '../Loader'
import Tooltip from '../Tooltip'
@ -19,7 +19,8 @@ export default function Price({
className?: string
small?: boolean
}): ReactElement {
const { getBestPrice } = useMetadata(ddo.id)
const { chainId } = useOcean()
const { getBestPrice } = useMetadata()
const [price, setPrice] = useState<string>()
useEffect(() => {
@ -28,7 +29,7 @@ export default function Price({
setPrice(price)
}
init()
}, [])
}, [chainId])
const styleClasses = cx({
price: true,