Skip to content

Commit

Permalink
fix empty markets
Browse files Browse the repository at this point in the history
  • Loading branch information
CleanBread committed Dec 16, 2024
1 parent 2a573d0 commit 0fe5da0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/compositions/events/Markets/Markets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ const Markets: React.FC<MarketsProps> = ({ gameId, gameStatus }) => {
return <MarketsSkeleton />
}

if (!markets?.length) {
return null
}

return (
<Content marketsByKey={marketsByKey} sortedMarkets={sortedMarkets} />
)
Expand Down
4 changes: 2 additions & 2 deletions src/compositions/events/Markets/utils/useMarket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const useMarket = ({ sortedMarkets, marketsByKey }: Props) => {
}

// try to find condition with Created status in active market
let nextConditionIndex = marketsByKey[activeMarket].outcomeRows[activeConditionIndex].findIndex(({ conditionId }) => {
return statuses[conditionId] === ConditionStatus.Created
let nextConditionIndex = marketsByKey[activeMarket].outcomeRows.findIndex((outcomes) => {
return outcomes.some(({ conditionId }) => statuses[conditionId] === ConditionStatus.Created)
})

if (nextConditionIndex !== -1) {
Expand Down
2 changes: 1 addition & 1 deletion src/compositions/events/TopEvents/TopEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const Card: React.FC<CardProps> = ({ game }) => {
<div className="bone w-full h-7 rounded-sm" />
</>
) : (
marketsRow.map(outcome => (
marketsRow?.map(outcome => (
<OutcomeButton key={outcome.outcomeId} outcome={outcome} />
))
)
Expand Down

0 comments on commit 0fe5da0

Please sign in to comment.