diff --git a/src/components/atoms/Price/index.tsx b/src/components/atoms/Price/index.tsx index 205e04a07..ad4efcd9d 100644 --- a/src/components/atoms/Price/index.tsx +++ b/src/components/atoms/Price/index.tsx @@ -29,7 +29,7 @@ export default function Price({ async function init() { const price = await getBestPrice(ddo.dataToken) setPrice(price) - setPriceOutside && setPriceOutside(price) + setPriceOutside && price !== '' && setPriceOutside(price) } init() }, [chainId]) diff --git a/src/components/organisms/AssetActions/Compute.tsx b/src/components/organisms/AssetActions/Compute.tsx index 289920dbe..cb2c4b449 100644 --- a/src/components/organisms/AssetActions/Compute.tsx +++ b/src/components/organisms/AssetActions/Compute.tsx @@ -33,22 +33,23 @@ export default function Compute({ ddo }: { ddo: DDO }): ReactElement { const [algorithmRawCode, setAlgorithmRawCode] = useState('') const [isPublished, setIsPublished] = useState(false) const [file, setFile] = useState(null) - const [isTermsAgreed, setIsTermsAgreed] = useState(true) const [price, setPrice] = useState() - const isFree = price === '0' - const isComputeButtonDisabled = isJobStarting || file === null || computeType === '' || !ocean || - !isBalanceSufficient || - !isTermsAgreed + !isBalanceSufficient useEffect(() => { if (!price || !balance || !balance.ocean) return - setIsBalanceSufficient(compareAsBN(balance.ocean, price, Comparison.gte)) + + const isFree = price === '0' + + setIsBalanceSufficient( + isFree ? true : compareAsBN(balance.ocean, price, Comparison.gte) + ) return () => { setIsBalanceSufficient(false) @@ -123,7 +124,6 @@ export default function Compute({ ddo }: { ddo: DDO }): ReactElement { Start job - {/* */}