From 25542ba55754d4b0ced7f9eb689faecd60f230eb Mon Sep 17 00:00:00 2001 From: Madalina Raicu Date: Thu, 29 Feb 2024 16:08:04 +0000 Subject: [PATCH] fix: dispatch strategy can be null --- apps/trading/lib/hooks/use-rewards.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/trading/lib/hooks/use-rewards.ts b/apps/trading/lib/hooks/use-rewards.ts index e0bc73776..59cb6045d 100644 --- a/apps/trading/lib/hooks/use-rewards.ts +++ b/apps/trading/lib/hooks/use-rewards.ts @@ -80,15 +80,14 @@ export const isActiveReward = (node: RewardTransfer, currentEpoch: number) => { * if the scope is set to individuals but the individuals are in a team. */ export const isScopedToTeams = (node: EnrichedRewardTransfer) => - (node.transfer.kind.dispatchStrategy && - // scoped to teams - node.transfer.kind.dispatchStrategy.entityScope === - EntityScope.ENTITY_SCOPE_TEAMS) || + // scoped to teams + node.transfer.kind.dispatchStrategy?.entityScope === + EntityScope.ENTITY_SCOPE_TEAMS || // or to individuals - (node.transfer.kind.dispatchStrategy.entityScope === + (node.transfer.kind.dispatchStrategy?.entityScope === EntityScope.ENTITY_SCOPE_INDIVIDUALS && // but they have to be in a team - node.transfer.kind.dispatchStrategy.individualScope === + node.transfer.kind.dispatchStrategy?.individualScope === IndividualScope.INDIVIDUAL_SCOPE_IN_TEAM); /** Retrieves rewards (transfers) */