Skip to content

Commit

Permalink
fix: put prediction market behind feature flag (#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosepuppy authored Oct 10, 2024
1 parent 7d4bf65 commit cc36791
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 @@ -3,6 +3,7 @@ import { useMemo } from 'react';
import { shallowEqual } from 'react-redux';

import { MARKET_FILTER_OPTIONS, MarketFilters, type MarketData } from '@/constants/markets';
import { StatsigFlags } from '@/constants/statsig';

import {
SEVEN_DAY_SPARKLINE_ENTRIES,
Expand All @@ -18,6 +19,8 @@ import { objectKeys, safeAssign } from '@/lib/objectHelpers';
import { matchesSearchFilter } from '@/lib/search';
import { orEmptyRecord } from '@/lib/typeUtils';

import { useAllStatsigGateValues } from './useStatsig';

const filterFunctions = {
[MarketFilters.AI]: (market: MarketData) => {
return market.tags?.includes('AI');
Expand Down Expand Up @@ -72,12 +75,15 @@ export const useMarketsData = (
);
const allAssets = orEmptyRecord(useAppSelector(getAssets, shallowEqual));
const sevenDaysSparklineData = usePerpetualMarketSparklines();
const featureFlags = useAllStatsigGateValues();

const markets = useMemo(() => {
const listOfMarkets = Object.values(allPerpetualMarkets)
.filter(isTruthy)
// temporary filterout TRUMPWIN until the backend is working
.filter((m) => m.assetId !== 'TRUMPWIN')
.filter(
(m) => m.assetId !== 'TRUMPWIN' || featureFlags?.[StatsigFlags.ffShowPredictionMarketsUi]
)
.map((marketData): MarketData => {
const sevenDaySparklineEntries = sevenDaysSparklineData?.[marketData.id]?.length ?? 0;
const isNew = Boolean(
Expand Down

0 comments on commit cc36791

Please sign in to comment.