Skip to content

Commit 0ff85f8

Browse files
committed
fix(web): crashing appeal tab
1 parent 34fa822 commit 0ff85f8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

web/src/hooks/useClassicAppealContext.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,15 @@ export const useFundingContext = () => useContext(FundingContext);
9999
export const useOptionsContext = () => useContext(OptionsContext);
100100

101101
const getCurrentLocalRound = (dispute?: ClassicAppealQuery["dispute"]) => {
102-
const period = dispute?.period;
103-
const currentLocalRoundIndex = dispute?.disputeKitDispute?.currentLocalRoundIndex;
104-
return getLocalRounds(dispute?.disputeKitDispute)[
105-
["appeal", "execution"].includes(period ?? "") ? currentLocalRoundIndex : currentLocalRoundIndex - 1
106-
];
102+
if (!dispute) return undefined;
103+
104+
const period = dispute.period;
105+
const currentLocalRoundIndex = dispute.disputeKitDispute?.currentLocalRoundIndex;
106+
const adjustedRoundIndex = ["appeal", "execution"].includes(period)
107+
? currentLocalRoundIndex
108+
: currentLocalRoundIndex - 1;
109+
110+
return getLocalRounds(dispute.disputeKitDispute)[adjustedRoundIndex];
107111
};
108112

109113
const getPaidFees = (dispute?: ClassicAppealQuery["dispute"]) => {

0 commit comments

Comments
 (0)