Skip to content

Commit 0676d67

Browse files
committed
refactor(web): hide-switch-chain-for-invalid-dispute
1 parent decdda8 commit 0676d67

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

web/src/pages/Cases/CaseDetails/Voting/Classic/OptionsContainer.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const Options: React.FC<IOptions> = ({ arbitrable, handleSelection, justificatio
6060

6161
// if RTA not found in dispute.answers, show RTA. shows RTA in case of invalid dispute too
6262
const showRTA = useMemo(
63-
() => isUndefined(disputeDetails?.answers.find((answer) => BigInt(answer.id) === BigInt(0))),
63+
() => isUndefined(disputeDetails?.answers?.find((answer) => BigInt(answer.id) === BigInt(0))),
6464
[disputeDetails]
6565
);
6666

@@ -82,22 +82,24 @@ const Options: React.FC<IOptions> = ({ arbitrable, handleSelection, justificatio
8282
{!isUndefined(justification) && !isUndefined(setJustification) ? (
8383
<JustificationArea {...{ justification, setJustification }} />
8484
) : null}
85-
<StyledEnsureChain>
86-
<OptionsContainer>
87-
{disputeDetails?.answers?.map((answer: Answer) => {
88-
return (
89-
<Tooltip text={answer.description} key={answer.title}>
90-
<Button
91-
text={answer.title}
92-
disabled={isSending}
93-
isLoading={chosenOption === BigInt(answer.id)}
94-
onClick={() => onClick(BigInt(answer.id))}
95-
/>
96-
</Tooltip>
97-
);
98-
})}
99-
</OptionsContainer>
100-
</StyledEnsureChain>
85+
{isUndefined(disputeDetails?.answers) ? null : (
86+
<StyledEnsureChain>
87+
<OptionsContainer>
88+
{disputeDetails?.answers?.map((answer: Answer) => {
89+
return (
90+
<Tooltip text={answer.description} key={answer.title}>
91+
<Button
92+
text={answer.title}
93+
disabled={isSending}
94+
isLoading={chosenOption === BigInt(answer.id)}
95+
onClick={() => onClick(BigInt(answer.id))}
96+
/>
97+
</Tooltip>
98+
);
99+
})}
100+
</OptionsContainer>
101+
</StyledEnsureChain>
102+
)}
101103
</MainContainer>
102104
{showRTA ? (
103105
<RefuseToArbitrateContainer>

0 commit comments

Comments
 (0)