Skip to content

fix(ui): handle empty string case in CopyTextCustomComp#4655

Open
JustYuvaraj wants to merge 1 commit intojuspay:mainfrom
JustYuvaraj:fix/empty-string-handling-copy-component
Open

fix(ui): handle empty string case in CopyTextCustomComp#4655
JustYuvaraj wants to merge 1 commit intojuspay:mainfrom
JustYuvaraj:fix/empty-string-handling-copy-component

Conversation

@JustYuvaraj
Copy link
Copy Markdown

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:

  • Added empty string check for connector_transaction_id in three places:
    • Line ~87 (getCell function for main table)
    • Line ~607 (attemptCellDetails function)
    • Line ~808 (second getCell for attempt details)

DisputesEntity.res:

  • Added empty string check for attempt_id field

Pattern Used

This follows the existing implementation in PayoutsEntity.res (lines 584-594) which correctly handles empty strings.

Related Issue

Fixes #3582

Testing

  • Verified the pattern matches the reference implementation
  • All changes follow the same empty string handling approach

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>
@JustYuvaraj JustYuvaraj requested a review from a team as a code owner April 2, 2026 10:16
Copilot AI review requested due to automatic review settings April 2, 2026 10:16
@semanticdiff-com
Copy link
Copy Markdown

Review changes with  SemanticDiff

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
/>,
"",
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
"",
attempt.connector_transaction_id,

Copilot uses AI. Check for mistakes.
customTextCss="w-36 truncate whitespace-nowrap"
displayValue=Some(order.connector_payment_id)
/>,
"",
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 "".

Suggested change
"",
order.connector_payment_id,

Copilot uses AI. Check for mistakes.
customTextCss="w-36 truncate whitespace-nowrap"
displayValue=Some(order.connector_payment_id)
/>,
"",
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"",
order.connector_payment_id,

Copilot uses AI. Check for mistakes.
<HelperComponents.CopyTextCustomComp
customTextCss="w-36 truncate whitespace-nowrap" displayValue=Some(disputesData.attempt_id)
/>,
"",
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"",
disputesData.attempt_id,

Copilot uses AI. Check for mistakes.
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.

GFI: Handle empty string case in certain places where CopyTextCustomComp is used

2 participants