Skip to content

fix(PM-1610): Show confirm modal while accepting application #1180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2025

Conversation

hentrymartin
Copy link
Collaborator

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/PM-1610

What's in this PR?

  • Show confirm modal while accepting application

@@ -0,0 +1,35 @@
/* eslint-disable react/jsx-no-bind */

Choose a reason for hiding this comment

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

Avoid using /* eslint-disable react/jsx-no-bind */. Instead, consider refactoring the code to avoid inline function definitions, which can lead to performance issues due to unnecessary re-renders.


const ConfirmModal: FC<ConfirmModalProps> = props => (
<BaseModal
onClose={props.onClose as () => void}

Choose a reason for hiding this comment

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

Casting props.onClose to () => void may hide potential type mismatches. Ensure that props.onClose is indeed compatible with () => void to avoid runtime errors.

@@ -31,19 +33,8 @@ const CopilotApplicationAction = (

if (copilotApplication.existingMembership) {

Choose a reason for hiding this comment

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

The return statement has been removed. Ensure that this change does not affect the intended flow of the function, as previously the function would exit early if copilotApplication.existingMembership was true.

@@ -57,6 +48,7 @@ const CopilotApplicationAction = (
toast.success('Accepted as copilot')
copilotApplication.onApplied()
setShowAlreadyMemberModal(false)
setShowConfirmModal(false)

Choose a reason for hiding this comment

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

It seems like setShowConfirmModal(false) is being called after a successful application acceptance. Ensure that this line is necessary and that the modal state is being managed correctly throughout the component lifecycle.

@@ -67,6 +59,7 @@ const CopilotApplicationAction = (
e.preventDefault()
e.stopPropagation()
setShowAlreadyMemberModal(false)
setShowConfirmModal(false)
}, [showAlreadyMemberModal])

Choose a reason for hiding this comment

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

The dependency array for the useCallback hook includes showAlreadyMemberModal, but it should also include setShowConfirmModal since it is used within the callback. Consider adding setShowConfirmModal to the dependency array to ensure the callback updates correctly when setShowConfirmModal changes.

@@ -106,6 +99,13 @@ const CopilotApplicationAction = (
copilotApplication={copilotApplication}
/>
)}

{showConfirmModal && (

Choose a reason for hiding this comment

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

The variable showConfirmModal should be initialized and managed properly to ensure the modal displays correctly. Ensure that the logic for setting showConfirmModal is implemented and tested.


{showConfirmModal && (
<ConfirmModal
onClose={onCloseModal}

Choose a reason for hiding this comment

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

Consider adding error handling or user feedback in case onApply fails to execute successfully. This will improve the user experience by providing clarity on the action's outcome.

@hentrymartin hentrymartin merged commit 8b8754c into dev Aug 10, 2025
3 checks passed
@hentrymartin hentrymartin deleted the pm-1610_1 branch August 10, 2025 20:02
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.

1 participant