Find last available session reward (#2000)
This commit is contained in:
parent
37744ecae3
commit
5ccd7453cc
@ -93,7 +93,9 @@ function Targets ({ className, sessionRewards, t }: Props): React.ReactElement<P
|
||||
|
||||
useEffect((): void => {
|
||||
if (sessionRewards && sessionRewards.length) {
|
||||
setLastReward(sessionRewards[sessionRewards.length - 1].reward);
|
||||
const lastRewardSession = [...sessionRewards].reverse().find(({ reward }): boolean => reward.gtn(0));
|
||||
|
||||
setLastReward(lastRewardSession?.reward || new BN(0));
|
||||
}
|
||||
}, [sessionRewards]);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user