From 9d8ba6d236e90d364e78915f48de27c159f682d1 Mon Sep 17 00:00:00 2001 From: Maxim Gordienko <3dmaxpayne@gmail.com> Date: Thu, 9 Sep 2021 18:23:59 +0300 Subject: [PATCH] fix auction view exception --- .../web/src/components/AuctionCard/index.tsx | 26 ++++++++++++------- .../components/AuctionRenderCard/index.tsx | 4 +-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/js/packages/web/src/components/AuctionCard/index.tsx b/js/packages/web/src/components/AuctionCard/index.tsx index 768cc60..f175c83 100644 --- a/js/packages/web/src/components/AuctionCard/index.tsx +++ b/js/packages/web/src/components/AuctionCard/index.tsx @@ -512,15 +512,23 @@ export const AuctionCard = ({ bids.length === 0 && auctionView.auctionDataExtended?.info.instantSalePrice ) { - const bid = await sendPlaceBid( - connection, - wallet, - myPayingAccount.pubkey, - auctionView, - accountByMint, - auctionView.auctionDataExtended?.info.instantSalePrice, - ); - setLastBid(bid); + try { + const bid = await sendPlaceBid( + connection, + wallet, + myPayingAccount.pubkey, + auctionView, + accountByMint, + auctionView.auctionDataExtended?.info.instantSalePrice, + ); + setLastBid(bid); + } catch (e) { + console.error('sendPlaceBid', e) + setShowBidModal(false); + setLoading(false); + return; + } + } await update(); diff --git a/js/packages/web/src/components/AuctionRenderCard/index.tsx b/js/packages/web/src/components/AuctionRenderCard/index.tsx index 4a0b677..2487efa 100644 --- a/js/packages/web/src/components/AuctionRenderCard/index.tsx +++ b/js/packages/web/src/components/AuctionRenderCard/index.tsx @@ -24,7 +24,7 @@ export interface AuctionCard extends CardProps { } export const AuctionRenderCard = (props: AuctionCard) => { - let { auctionView } = props; + const { auctionView } = props; const id = auctionView.thumbnail.metadata.pubkey; const art = useArt(id); const name = art?.title || ' '; @@ -42,7 +42,7 @@ export const AuctionRenderCard = (props: AuctionCard) => { const isUpcoming = auctionView.state === AuctionViewState.Upcoming; const winningBid = useHighestBidForAuction(auctionView.auction.pubkey); - const ended = + const ended = !auctionView.isInstantSale && state?.hours === 0 && state?.minutes === 0 && state?.seconds === 0; let currentBid: number | string = 0;