From 59501ea904dd693621b499915aa19b64ebd5e0cd Mon Sep 17 00:00:00 2001 From: Juanma Hidalgo Date: Thu, 30 Nov 2023 16:00:18 +0100 Subject: [PATCH 1/2] fix: remove the cancel logic from the BestBuyingOption main useEffect --- .../AssetPage/BestBuyingOption/BestBuyingOption.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx b/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx index 0357e18c52..00b4b196d7 100644 --- a/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx +++ b/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx @@ -52,7 +52,6 @@ const BestBuyingOption = ({ asset, tableRef }: Props) => { } useEffect(() => { - let cancel = false if (asset && !isNFT(asset)) { if (asset.available > 0 && asset.isOnSale) { setBuyOption(BuyOptions.MINT) @@ -76,7 +75,6 @@ const BestBuyingOption = ({ asset, tableRef }: Props) => { .fetchOrders(params, sortBy) .then(response => { if (response.data.length > 0) { - if (cancel) return setBuyOption(BuyOptions.BUY_LISTING) setListing({ order: response.data[0], total: response.total }) bidAPI @@ -88,28 +86,23 @@ const BestBuyingOption = ({ asset, tableRef }: Props) => { '1' ) .then(response => { - if (cancel) return setIsLoading(false) setMostExpensiveBid(response.data[0]) }) .catch(error => { - if (!cancel) setIsLoading(false) console.error(error) + setIsLoading(false) }) } else { - if (cancel) return setIsLoading(false) } }) .catch(error => { - if (!cancel) setIsLoading(false) console.error(error) + setIsLoading(false) }) } } - return () => { - cancel = true - } }, [asset, listing]) const customClasses = { @@ -119,6 +112,7 @@ const BestBuyingOption = ({ asset, tableRef }: Props) => { buyWithCardClassName: styles.buyWithCardClassName } + console.log('isLoading: ', isLoading) return isLoading ? null : (
Date: Thu, 30 Nov 2023 16:09:37 +0100 Subject: [PATCH 2/2] chore: remove console.log --- .../components/AssetPage/BestBuyingOption/BestBuyingOption.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx b/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx index 00b4b196d7..d868e9ba70 100644 --- a/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx +++ b/webapp/src/components/AssetPage/BestBuyingOption/BestBuyingOption.tsx @@ -112,7 +112,6 @@ const BestBuyingOption = ({ asset, tableRef }: Props) => { buyWithCardClassName: styles.buyWithCardClassName } - console.log('isLoading: ', isLoading) return isLoading ? null : (