show failed status from the thaw schedule endpoint#4482
Conversation
packages/yoroi-extension/app/UI/features/airdrop/useCases/AddressDetails.tsx
Show resolved
Hide resolved
| return schedule.thaws | ||
| .slice(schedule.numberOfClaimedAllocations) | ||
| .filter(thaw => thaw.status === 'redeemable') | ||
| .filter(thaw => thaw.status === 'redeemable' || thaw.status === 'failed') |
There was a problem hiding this comment.
Failed thaws incorrectly counted in redeemable amount
High Severity
The getRedeemableAmount function now includes thaws with 'failed' status in the redeemable total. This causes failed thaw amounts to be shown to users as redeemable, enables the Redeem button when only failed thaws exist, and marks the overall status as 'ready'. Failed thaws by definition have already failed and likely cannot be redeemed, making this amount misleading to users and potentially triggering redemption flows that will fail.
| const redeemableIndex = schedule.thaws.findIndex(thaw => thaw.status === 'redeemable' || thaw.status === 'failed'); | ||
| if (redeemableIndex >= 0) return redeemableIndex; | ||
| const upcomingIndex = schedule.thaws.findIndex(thaw => thaw.status === 'upcoming'); | ||
| const upcomingIndex = schedule.thaws.findIndex(thaw => thaw.status === 'upcoming' || thaw.status === 'failed'); |
There was a problem hiding this comment.
Redundant failed status check is dead code
Low Severity
The || thaw.status === 'failed' condition on line 163 (checking for 'upcoming' || 'failed') is unreachable. If any failed thaw exists, it will be found by the first findIndex on line 161 (which already checks for 'failed'), and the function returns before reaching line 163. This suggests confusion about how failed thaws should be handled for determining the current thaw index.
| type ThawStatus = 'redeemable' | 'confirmed' | 'upcoming' | 'failed'; | ||
|
|
||
| function getThawStatusType(status: string): ThawStatus { | ||
| if (status === 'failed') return 'failed'; |
There was a problem hiding this comment.
Failed status badge missing distinct visual styling
Low Severity
The getStatusBadgeStyle function has no case for 'failed' status, so it falls through to the default case and receives the same gray styling as 'upcoming' items. This creates an inconsistent UI where failed thaws display a distinct red X icon in the step indicator but their status badge looks identical to "Not available yet" badges. Given this PR specifically adds failed status display with distinct visual treatment elsewhere, the badge styling appears to be an incomplete implementation.
Note
Introduces explicit handling of the
failedthaw status in the Midnight airdrop flow.AddressDetailsnow treatsfailedas a distinct status (type, badge styling, status message, and current thaw index), with a visual X icon and adjusted step colorsgetRedeemableAmountnow includes thaws with statusfailedalongsideredeemableairdrop.schedule.failedand exposesstrings.failedviauseStringsWritten by Cursor Bugbot for commit e4c8c86. This will update automatically on new commits. Configure here.