diff --git a/src/features/TakeNow/ui/MultiInformantBadge.tsx b/src/features/TakeNow/ui/MultiInformantBadge.tsx index 7def6dd12..9f039b528 100644 --- a/src/features/TakeNow/ui/MultiInformantBadge.tsx +++ b/src/features/TakeNow/ui/MultiInformantBadge.tsx @@ -5,21 +5,18 @@ import { Box } from '~/shared/ui'; import { useLaunchDarkly } from '~/shared/utils/hooks/useLaunchDarkly'; export const MultiInformantBadge = () => { - const { getMultiInformantState } = useMultiInformantState(); + const { getMultiInformantState, isInMultiInformantFlow } = useMultiInformantState(); const { flags: featureFlags } = useLaunchDarkly(); - const multiInformantState = getMultiInformantState(); - - if ( - multiInformantState.sourceSubject === undefined || - multiInformantState.targetSubject === undefined || - multiInformantState.sourceSubject.id === multiInformantState.targetSubject.id || - !featureFlags.enableMultiInformant - ) { + if (!isInMultiInformantFlow() || !featureFlags.enableMultiInformant) { return null; } - const { sourceSubject, targetSubject } = multiInformantState; + const { sourceSubject, targetSubject } = getMultiInformantState(); + + if (!sourceSubject || !targetSubject) { + return null; + } return (