Skip to content

Commit e8770d5

Browse files
committed
Memoize reward runs counting
1 parent e2baa27 commit e8770d5

File tree

1 file changed

+5
-1
lines changed
  • apps/web/src/components/layouts/AppLayout/Header/Rewards/Content

1 file changed

+5
-1
lines changed

apps/web/src/components/layouts/AppLayout/Header/Rewards/Content/RewardItem.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export function RewardItem({
2626
return claimedRewards.some((r) => r.rewardType === type)
2727
}, [isLoading, claimedRewards, type])
2828

29+
const rewardCount = useMemo(() => {
30+
return formatCount(REWARD_VALUES[type])
31+
}, [type])
32+
2933
return (
3034
<span className='w-full'>
3135
<Button
@@ -63,7 +67,7 @@ export function RewardItem({
6367
size='large'
6468
className='flex-shrink-0'
6569
>
66-
+{formatCount(REWARD_VALUES[type])} runs
70+
+{rewardCount} runs
6771
</Badge>
6872
</div>
6973
</Button>

0 commit comments

Comments
 (0)