From 51cacc55c943f32f7e360b132fe6d84bda8ca586 Mon Sep 17 00:00:00 2001 From: PhilReact Date: Sat, 21 Jun 2025 08:38:26 +0300 Subject: [PATCH] fix duplicates --- src/components/Grids/TradeOffers.tsx | 18 +++++++++++++----- src/components/history/HistoryList.tsx | 6 +++--- src/components/sell/CreateSell.tsx | 1 - src/components/sell/TradeBotList.tsx | 1 - src/components/sell/UnsignedFees.tsx | 6 +++--- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/Grids/TradeOffers.tsx b/src/components/Grids/TradeOffers.tsx index 8de2fd9..4fa10cb 100644 --- a/src/components/Grids/TradeOffers.tsx +++ b/src/components/Grids/TradeOffers.tsx @@ -57,7 +57,7 @@ import { export const baseLocalHost = window.location.host; // export const baseLocalHost = "devnet-nodes.qortal.link:11111"; -// export const baseLocalHost = "127.0.0.1:12391"; +// export const baseLocalHost = "127.0.0.1:22391"; import CloseIcon from "@mui/icons-material/Close"; import ContentCopyIcon from "@mui/icons-material/ContentCopy"; @@ -208,15 +208,15 @@ export const TradeOffers: React.FC = ({ isFetchingName.current[address] = true const response = await requestQueueGetNames.enqueue( () => { - return fetch("/names/address/" + address); + return fetch("/names/primary/" + address); } ); const nameData = await response.json(); - if (nameData?.length > 0) { + if (nameData?.name) { setQortalNames((prev) => { return { ...prev, - [address]: nameData[0].name, + [address]: nameData.name, }; }); } else { @@ -476,7 +476,15 @@ export const TradeOffers: React.FC = ({ } } } - + offeringTrades.current = Object.values( + offeringTrades.current.reduce((acc, trade) => { + const key = trade.qortalAtAddress; + if (!acc[key] || trade.timestamp > acc[key].timestamp) { + acc[key] = trade; + } + return acc; + }, {} as Record) +); let filteredOffers = offeringTrades.current?.filter((offeringTrade) => filterOffersUsingTradePresence(offeringTrade) diff --git a/src/components/history/HistoryList.tsx b/src/components/history/HistoryList.tsx index 4da4fd4..0f5763f 100644 --- a/src/components/history/HistoryList.tsx +++ b/src/components/history/HistoryList.tsx @@ -37,13 +37,13 @@ export default function HistoryList({ qortAddress, historyList }) { const getName = async (address) => { try { - const response = await fetch("/names/address/" + address); + const response = await fetch("/names/primary/" + address); const nameData = await response.json(); - if (nameData?.length > 0) { + if (nameData?.name) { setQortalNames((prev) => { return { ...prev, - [address]: nameData[0].name, + [address]: nameData.name, }; }); } else { diff --git a/src/components/sell/CreateSell.tsx b/src/components/sell/CreateSell.tsx index b627de1..543ba69 100644 --- a/src/components/sell/CreateSell.tsx +++ b/src/components/sell/CreateSell.tsx @@ -363,7 +363,6 @@ const StuckOrders = ({setOpenStuckOrders})=> { const timestampB = b?.timestamp ?? b?.creationTimestamp ?? 0; return timestampB - timestampA; // Newest first }); - return ( { if (socketRef.current) { socketRef.current.close(1000, "forced"); // Close with a custom reason diff --git a/src/components/sell/UnsignedFees.tsx b/src/components/sell/UnsignedFees.tsx index 60946bd..16ceae7 100644 --- a/src/components/sell/UnsignedFees.tsx +++ b/src/components/sell/UnsignedFees.tsx @@ -64,8 +64,8 @@ export default function UnsignedFees({ qortAddress }) { }, []) - const restartUnsignedFeeSocket = () => { - getUnsignedFees() + const restartUnsignedFeeSocket = (address) => { + getUnsignedFees(address) setTimeout(() => initUnsignedFeeSocket(true), 50); }; @@ -106,7 +106,7 @@ export default function UnsignedFees({ qortAddress }) { if (event.reason === "forced") { return; } - restartUnsignedFeeSocket(); + restartUnsignedFeeSocket(qortAddressRef.current); }; socketRef.current.onerror = (e) => { clearTimeout(socketTimeout);