Skip to content

Conversation

@vas3a
Copy link
Collaborator

@vas3a vas3a commented Feb 6, 2026

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/PM-3698 - rontend Implementation for Engagement Payment Approver & Bulk Approval

What's in this PR?

image image image image


toast.success('Starting bulk approve', { position: toast.POSITION.BOTTOM_RIGHT })

for (const id of ids) {
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
Using any for the updates type can lead to runtime errors and makes the code harder to maintain. Consider defining a specific type for updates to ensure type safety.

// awaiting sequentially to preserve order and server load control
// errors for individual items are caught and reported
// eslint-disable-next-line no-await-in-loop
const msg = await editPayment(updates)
Copy link

Choose a reason for hiding this comment

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

[⚠️ performance]
Using await inside a loop can lead to performance issues as each iteration waits for the previous one to complete. Consider using Promise.all to handle these promises concurrently if order is not important.

const msg = await editPayment(updates)
toast.success(msg, { position: toast.POSITION.BOTTOM_RIGHT })
} catch (err:any) {
if (err?.message) {
Copy link

Choose a reason for hiding this comment

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

[💡 maintainability]
Catching errors with any type can obscure the actual error structure. Consider using a more specific error type or checking for known properties to improve error handling.

onConfirm={function onConfirm() {
onBulkApprove(bulkAuditNote)
}}
canSave={bulkAuditNote.trim().length > 0}
Copy link

Choose a reason for hiding this comment

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

[💡 correctness]
The canSave condition relies on bulkAuditNote.trim().length > 0, which might not be sufficient for validating the input. Consider adding more validation logic if necessary.

size='lg'
/>
)}
{props.selectedCount && props.selectedCount > 0 && (
Copy link

Choose a reason for hiding this comment

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

[💡 readability]
The condition props.selectedCount && props.selectedCount > 0 can be simplified to props.selectedCount > 0 since selectedCount being a number will inherently evaluate to false if it is 0 or undefined.

}
}, [props.selectedPayments])

// Only rows with this status are selectable for bulk actions
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The selectableStatus variable is hardcoded as 'On Hold (Admin)'. Consider making this configurable or documenting its significance to ensure maintainability if the status values change in the future.

const someVisibleSelected = visibleSelectablePayments.some(p => selectedPayments[p.id]) && !allVisibleSelected

const onToggleSelectAll = (checked: boolean) => {
if (checked) {
Copy link

Choose a reason for hiding this comment

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

[💡 style]
In onToggleSelectAll, the next object is created and populated using forEach. Consider using reduce to directly construct the object, which can be more concise and functional.

type='checkbox'
aria-label='Select All'
checked={allVisibleSelected}
ref={el => { if (el) el.indeterminate = someVisibleSelected }}
Copy link

Choose a reason for hiding this comment

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

[⚠️ design]
Setting the indeterminate property directly on the DOM element in the ref callback is a side effect that could be better handled in a useEffect hook to ensure consistency and avoid unexpected behavior.

@vas3a vas3a merged commit e4e8602 into dev Feb 9, 2026
8 checks passed
@vas3a vas3a deleted the PM-3698_bulk-update-engagement-payments branch February 9, 2026 14:42
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.

2 participants