fix duplicates

This commit is contained in:
PhilReact 2025-06-21 08:38:26 +03:00
parent 00634bca04
commit 51cacc55c9
5 changed files with 19 additions and 13 deletions

View File

@ -57,7 +57,7 @@ import {
export const baseLocalHost = window.location.host; export const baseLocalHost = window.location.host;
// export const baseLocalHost = "devnet-nodes.qortal.link:11111"; // 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 CloseIcon from "@mui/icons-material/Close";
import ContentCopyIcon from "@mui/icons-material/ContentCopy"; import ContentCopyIcon from "@mui/icons-material/ContentCopy";
@ -208,15 +208,15 @@ export const TradeOffers: React.FC<any> = ({
isFetchingName.current[address] = true isFetchingName.current[address] = true
const response = await requestQueueGetNames.enqueue( const response = await requestQueueGetNames.enqueue(
() => { () => {
return fetch("/names/address/" + address); return fetch("/names/primary/" + address);
} }
); );
const nameData = await response.json(); const nameData = await response.json();
if (nameData?.length > 0) { if (nameData?.name) {
setQortalNames((prev) => { setQortalNames((prev) => {
return { return {
...prev, ...prev,
[address]: nameData[0].name, [address]: nameData.name,
}; };
}); });
} else { } else {
@ -476,7 +476,15 @@ export const TradeOffers: React.FC<any> = ({
} }
} }
} }
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<string, typeof offeringTrades.current[number]>)
);
let filteredOffers = let filteredOffers =
offeringTrades.current?.filter((offeringTrade) => offeringTrades.current?.filter((offeringTrade) =>
filterOffersUsingTradePresence(offeringTrade) filterOffersUsingTradePresence(offeringTrade)

View File

@ -37,13 +37,13 @@ export default function HistoryList({ qortAddress, historyList }) {
const getName = async (address) => { const getName = async (address) => {
try { try {
const response = await fetch("/names/address/" + address); const response = await fetch("/names/primary/" + address);
const nameData = await response.json(); const nameData = await response.json();
if (nameData?.length > 0) { if (nameData?.name) {
setQortalNames((prev) => { setQortalNames((prev) => {
return { return {
...prev, ...prev,
[address]: nameData[0].name, [address]: nameData.name,
}; };
}); });
} else { } else {

View File

@ -363,7 +363,6 @@ const StuckOrders = ({setOpenStuckOrders})=> {
const timestampB = b?.timestamp ?? b?.creationTimestamp ?? 0; const timestampB = b?.timestamp ?? b?.creationTimestamp ?? 0;
return timestampB - timestampA; // Newest first return timestampB - timestampA; // Newest first
}); });
return ( return (
<BootstrapDialog <BootstrapDialog
aria-labelledby="customized-dialog-title" aria-labelledby="customized-dialog-title"

View File

@ -167,7 +167,6 @@ export default function TradeBotList({ qortAddress, failedTradeBots }) {
setTradeBotList(sellTrades); setTradeBotList(sellTrades);
tradeBotListRef.current = sellTrades; tradeBotListRef.current = sellTrades;
}; };
const restartTradeOffers = () => { const restartTradeOffers = () => {
if (socketRef.current) { if (socketRef.current) {
socketRef.current.close(1000, "forced"); // Close with a custom reason socketRef.current.close(1000, "forced"); // Close with a custom reason

View File

@ -64,8 +64,8 @@ export default function UnsignedFees({ qortAddress }) {
}, []) }, [])
const restartUnsignedFeeSocket = () => { const restartUnsignedFeeSocket = (address) => {
getUnsignedFees() getUnsignedFees(address)
setTimeout(() => initUnsignedFeeSocket(true), 50); setTimeout(() => initUnsignedFeeSocket(true), 50);
}; };
@ -106,7 +106,7 @@ export default function UnsignedFees({ qortAddress }) {
if (event.reason === "forced") { if (event.reason === "forced") {
return; return;
} }
restartUnsignedFeeSocket(); restartUnsignedFeeSocket(qortAddressRef.current);
}; };
socketRef.current.onerror = (e) => { socketRef.current.onerror = (e) => {
clearTimeout(socketTimeout); clearTimeout(socketTimeout);