fix(ui): handle empty string case in CopyTextCustomComp#4655
fix(ui): handle empty string case in CopyTextCustomComp#4655JustYuvaraj wants to merge 1 commit intojuspay:mainfrom
Conversation
Added empty string handling for connector_transaction_id and attempt_id fields to display 'NA' instead of showing an empty copy button. Changes: - OrderEntity.res: Handle empty connector_transaction_id in 3 places - DisputesEntity.res: Handle empty attempt_id Follows the same pattern used in PayoutsEntity.res (lines 584-594) Fixes juspay#3582 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates transaction UI table cells that use CopyTextCustomComp so that empty-string IDs render as "NA" (without a copy button), matching the existing pattern used in PayoutsEntity.res and addressing issue #3582.
Changes:
- Added empty-string checks before rendering copyable cells for connector transaction/payment identifiers in
OrderEntity.res. - Added empty-string checks before rendering the attempt ID copy cell in
DisputesEntity.res.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/screens/Transaction/Order/OrderEntity.res |
Adds empty-string handling for connector transaction-related IDs in attempt rows and order summary/detail cells. |
src/screens/Transaction/Disputes/DisputesEntity.res |
Adds empty-string handling for attempt_id to avoid showing an empty copy UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| customTextCss="w-36 truncate whitespace-nowrap" | ||
| displayValue=Some(attempt.connector_transaction_id) | ||
| />, | ||
| "", |
There was a problem hiding this comment.
CustomCell's second argument is currently the empty string. That value is used by TableUtils.getTableCellValue (e.g., for sort enablement/CSV export), so this makes the ConnectorTransactionID column effectively unsortable and export the wrong value. Pass attempt.connector_transaction_id as the CustomCell value (and keep Text("NA") for the empty case).
| "", | |
| attempt.connector_transaction_id, |
| customTextCss="w-36 truncate whitespace-nowrap" | ||
| displayValue=Some(order.connector_payment_id) | ||
| />, | ||
| "", |
There was a problem hiding this comment.
CustomCell(..., "") uses an empty string as the cell value. Since table sorting/CSV export rely on TableUtils.getTableCellValue, this means the ConnectorTransactionID column won’t sort/export by order.connector_payment_id. Use the connector id as the CustomCell value instead of "".
| "", | |
| order.connector_payment_id, |
| customTextCss="w-36 truncate whitespace-nowrap" | ||
| displayValue=Some(order.connector_payment_id) | ||
| />, | ||
| "", |
There was a problem hiding this comment.
This CustomCell still uses "" as its backing value. TableUtils.getTableCellValue will then return "" for non-empty connector IDs, which breaks sorting/export semantics for this column. Provide order.connector_payment_id as the CustomCell value.
| "", | |
| order.connector_payment_id, |
| <HelperComponents.CopyTextCustomComp | ||
| customTextCss="w-36 truncate whitespace-nowrap" displayValue=Some(disputesData.attempt_id) | ||
| />, | ||
| "", |
There was a problem hiding this comment.
CustomCell is created with a backing value of "". Since TableUtils.getTableCellValue uses that value for sorting/CSV export, the AttemptId column will not sort/export correctly. Pass disputesData.attempt_id as the CustomCell value instead.
| "", | |
| disputesData.attempt_id, |
Description
Addresses issue #3582 - Added empty string handling for fields rendered via CopyTextCustomComp to display 'NA' instead of an empty copy button.
Changes
OrderEntity.res:
DisputesEntity.res:
Pattern Used
This follows the existing implementation in PayoutsEntity.res (lines 584-594) which correctly handles empty strings.
Related Issue
Fixes #3582
Testing