Skip to content

Commit 1671d34

Browse files
fix(web): nan-current-ruling
1 parent 7e7a4f5 commit 1671d34

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

web/src/components/Verdict/FinalDecision.tsx

+14-5
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,14 @@ const FinalDecision: React.FC<IFinalDecision> = ({ arbitrable }) => {
9393
const localRounds = getLocalRounds(votingHistory?.dispute?.disputeKitDispute);
9494
const ruled = disputeDetails?.dispute?.ruled ?? false;
9595
const periodIndex = Periods[disputeDetails?.dispute?.period ?? "evidence"];
96-
const { data: currentRulingArray } = useReadKlerosCoreCurrentRuling({
96+
const { data: currentRulingArray, isLoading: isLoadingCurrentRuling } = useReadKlerosCoreCurrentRuling({
9797
query: { refetchInterval: REFETCH_INTERVAL },
9898
args: [BigInt(id ?? 0)],
9999
chainId: DEFAULT_CHAIN,
100100
});
101-
const currentRuling = Number(currentRulingArray?.[0]);
102-
const answer = populatedDisputeData?.answers?.find((answer) => BigInt(answer.id) === BigInt(currentRuling ?? 0));
101+
const currentRuling = Number(currentRulingArray?.[0] ?? 0);
102+
103+
const answer = populatedDisputeData?.answers?.find((answer) => BigInt(answer.id) === BigInt(currentRuling));
103104
const rounds = votingHistory?.dispute?.rounds;
104105
const jurorRewardsDispersed = useMemo(() => Boolean(rounds?.every((round) => round.jurorRewardsDispersed)), [rounds]);
105106
const buttonText = useMemo(() => {
@@ -122,13 +123,21 @@ const FinalDecision: React.FC<IFinalDecision> = ({ arbitrable }) => {
122123
{ruled && (
123124
<JuryContainer>
124125
<JuryDecisionTag>The jury decided in favor of:</JuryDecisionTag>
125-
<AnswerDisplay {...{ answer, currentRuling }} />
126+
{isLoadingCurrentRuling ? (
127+
<Skeleton height={14} width={60} />
128+
) : (
129+
<AnswerDisplay {...{ answer, currentRuling }} />
130+
)}
126131
</JuryContainer>
127132
)}
128133
{!ruled && periodIndex > 1 && localRounds?.at(localRounds.length - 1)?.totalVoted > 0 && (
129134
<JuryContainer>
130135
<JuryDecisionTag>This option is winning:</JuryDecisionTag>
131-
<AnswerDisplay {...{ answer, currentRuling }} />
136+
{isLoadingCurrentRuling ? (
137+
<Skeleton height={14} width={60} />
138+
) : (
139+
<AnswerDisplay {...{ answer, currentRuling }} />
140+
)}
132141
</JuryContainer>
133142
)}
134143
</VerdictContainer>

0 commit comments

Comments
 (0)