Skip to content

Conversation

@Maphikza
Copy link
Member

Fix: Handle Null Receive Addresses in TopUpBalanceModal

Problem

When there are no receive addresses returned from the API, the application fails to handle the null/empty array properly, potentially causing errors or a poor user experience.

Solution

This PR implements proper error handling and empty state management for the receive addresses functionality:

Changes in TopUpBalanceModal.tsx:

  • Added an error state to track and display API errors
  • Modified API response handling to ensure we always have a valid array with response.data || []
  • Added conditional rendering to show either error messages or the address list
  • Improved error handling with user-friendly error messages

Changes in AddressList.tsx:

  • Added a styled EmptyMessage component to display when there are no addresses
  • Implemented a check at the beginning of the component to handle empty or null address arrays
  • Added a user-friendly message "No receiving addresses available at the moment"

Benefits

  • Improved application stability by preventing errors when no addresses are available
  • Enhanced user experience with clear feedback when no addresses are found
  • Consistent error handling pattern that can be applied to other components

@f7f376a1fcd0d0e11a10ed1b6577c9 f7f376a1fcd0d0e11a10ed1b6577c9 merged commit 1fb3461 into main May 16, 2025
2 checks passed
@AnthonyMarin AnthonyMarin deleted the feature/generic-settings branch June 26, 2025 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants