From 413f8c43c87cdc24227bc2bd0f2e8aa3c718cf17 Mon Sep 17 00:00:00 2001 From: Linkie Link Date: Fri, 9 Feb 2024 08:42:37 +0100 Subject: [PATCH] Mp 2227 assetselect search (#782) * feat: split perps into active and non active positions * fix: fixed the search of assets selector * fix: according to feedback --- .../AssetSelector/AssetOverlay/index.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/trade/TradeModule/AssetSelector/AssetOverlay/index.tsx b/src/components/trade/TradeModule/AssetSelector/AssetOverlay/index.tsx index 91bf68e9..46c1db48 100644 --- a/src/components/trade/TradeModule/AssetSelector/AssetOverlay/index.tsx +++ b/src/components/trade/TradeModule/AssetSelector/AssetOverlay/index.tsx @@ -87,18 +87,16 @@ export default function AssetOverlay(props: Props) { ) const [activePerpsPositions, availablePerpsMarkets] = useMemo(() => { - const activePerpsPositions = - account?.perps.length === 0 - ? [] - : props.buyAssets.filter((assets) => - account?.perps.find((perp) => perp.denom === assets.denom), - ) - const availablePerpsMarkets = props.buyAssets.filter( + if (!account) return [[], []] + const activePerpsPositions = assets.filter((assets) => + account?.perps.find((perp) => perp.denom === assets.denom), + ) + const availablePerpsMarkets = assets.filter( (assets) => !activePerpsPositions.find((perp) => perp.denom === assets.denom), ) return [activePerpsPositions, availablePerpsMarkets] - }, [props.buyAssets, account]) + }, [assets, account]) return (