Skip to content

Commit

Permalink
fix: market filter (#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo authored Nov 19, 2024
1 parent 4ccb49b commit e374b07
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hooks/useMarketsData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ export const useMarketsData = ({
const favoritedMarkets = useAppSelector(getFavoritedMarkets, shallowEqual);
const hasMarketIds = Object.keys(allPerpetualMarkets).length > 0;

const allPerpetualMarketIdsSet = new Set(
Object.values(allPerpetualMarkets)
.filter(isTruthy)
.map((m) => m.assetId)
);

const markets = useMemo(() => {
const listOfMarkets = Object.values(allPerpetualMarkets)
.filter(isTruthy)
Expand Down Expand Up @@ -218,7 +224,7 @@ export const useMarketsData = ({
tickSizeDecimals,
} = market;

if (listOfMarkets.some((m) => m.assetId === assetId)) return null;
if (allPerpetualMarketIdsSet.has(assetId)) return null;

const id = getMarketIdFromAsset(assetId);

Expand Down

0 comments on commit e374b07

Please sign in to comment.