feat: [subscription-update] - improve wrongly renamed hook

This commit is contained in:
maciek 2022-09-16 11:32:54 +02:00
parent b122b4a135
commit 12c32b440d

View File

@ -5,37 +5,32 @@ import type { MarketsListData } from '@vegaprotocol/market-list';
const useMarketsFilterData = (data: MarketsListData, params: RouterParams) => {
const markets =
useMemo(
() =>
data?.markets?.filter((item) => {
if (
params.product &&
params.product !==
item.tradableInstrument.instrument.product.__typename
) {
return false;
}
if (
params.asset &&
params.asset !== 'all' &&
params.asset !==
item.tradableInstrument.instrument.product.settlementAsset.symbol
) {
return false;
}
const state =
params.state === 'all'
? ''
: params.state
? params.state
: MarketState.STATE_ACTIVE;
if (state && state !== item.state) {
return false;
}
return true;
}),
[data, params.state, params.product, params.asset]
) || [];
data?.markets?.filter((item) => {
if (
params.product &&
params.product !== item.tradableInstrument.instrument.product.__typename
) {
return false;
}
if (
params.asset &&
params.asset !== 'all' &&
params.asset !==
item.tradableInstrument.instrument.product.settlementAsset.symbol
) {
return false;
}
const state =
params.state === 'all'
? ''
: params.state
? params.state
: MarketState.STATE_ACTIVE;
if (state && state !== item.state) {
return false;
}
return true;
}) || [];
return useMemo(
() =>