@@ -93,13 +93,14 @@ const FinalDecision: React.FC<IFinalDecision> = ({ arbitrable }) => {
93
93
const localRounds = getLocalRounds ( votingHistory ?. dispute ?. disputeKitDispute ) ;
94
94
const ruled = disputeDetails ?. dispute ?. ruled ?? false ;
95
95
const periodIndex = Periods [ disputeDetails ?. dispute ?. period ?? "evidence" ] ;
96
- const { data : currentRulingArray } = useReadKlerosCoreCurrentRuling ( {
96
+ const { data : currentRulingArray , isLoading : isLoadingCurrentRuling } = useReadKlerosCoreCurrentRuling ( {
97
97
query : { refetchInterval : REFETCH_INTERVAL } ,
98
98
args : [ BigInt ( id ?? 0 ) ] ,
99
99
chainId : DEFAULT_CHAIN ,
100
100
} ) ;
101
- const currentRuling = Number ( currentRulingArray ?. [ 0 ] ) ;
102
- const answer = populatedDisputeData ?. answers ?. [ currentRuling ! - 1 ] ;
101
+ const currentRuling = Number ( currentRulingArray ?. [ 0 ] ?? 0 ) ;
102
+
103
+ const answer = populatedDisputeData ?. answers ?. find ( ( answer ) => BigInt ( answer . id ) === BigInt ( currentRuling ) ) ;
103
104
const rounds = votingHistory ?. dispute ?. rounds ;
104
105
const jurorRewardsDispersed = useMemo ( ( ) => Boolean ( rounds ?. every ( ( round ) => round . jurorRewardsDispersed ) ) , [ rounds ] ) ;
105
106
const buttonText = useMemo ( ( ) => {
@@ -122,13 +123,21 @@ const FinalDecision: React.FC<IFinalDecision> = ({ arbitrable }) => {
122
123
{ ruled && (
123
124
< JuryContainer >
124
125
< 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
+ ) }
126
131
</ JuryContainer >
127
132
) }
128
133
{ ! ruled && periodIndex > 1 && localRounds ?. at ( localRounds . length - 1 ) ?. totalVoted > 0 && (
129
134
< JuryContainer >
130
135
< JuryDecisionTag > This option is winning:</ JuryDecisionTag >
131
- < AnswerDisplay { ...{ answer, currentRuling } } />
136
+ { isLoadingCurrentRuling ? (
137
+ < Skeleton height = { 14 } width = { 60 } />
138
+ ) : (
139
+ < AnswerDisplay { ...{ answer, currentRuling } } />
140
+ ) }
132
141
</ JuryContainer >
133
142
) }
134
143
</ VerdictContainer >
0 commit comments