@@ -65,6 +65,10 @@ const CopilotOpportunityDetails: FC<{}> = () => {
65
65
[ profile ] ,
66
66
)
67
67
const { data : copilotApplications } : { data ?: CopilotApplication [ ] } = useCopilotApplications ( opportunityId )
68
+ const appliedCopilotApplications = useMemo (
69
+ ( ) => copilotApplications ?. filter ( item => item . userId === profile ?. userId ) ,
70
+ [ copilotApplications , profile ] ,
71
+ )
68
72
const { data : members } : { data ?: FormattedMembers [ ] } = useMembers (
69
73
copilotApplications ? copilotApplications ?. map ( item => item . userId ) : [ ] ,
70
74
)
@@ -164,17 +168,17 @@ const CopilotOpportunityDetails: FC<{}> = () => {
164
168
title = 'Copilot Opportunity'
165
169
buttonConfig = {
166
170
isCopilot
167
- && copilotApplications
168
- && copilotApplications . length === 0
171
+ && appliedCopilotApplications
172
+ && appliedCopilotApplications . length === 0
169
173
&& opportunity ?. status === 'active'
170
174
&& opportunity ?. canApplyAsCopilot ? applyCopilotOpportunityButton : undefined
171
175
}
172
176
secondaryButtonConfig = {
173
177
opportunity ?. status === 'active'
174
178
&& isAdminOrPM ? cancelCopilotOpportunityButton : undefined
175
179
}
176
- infoComponent = { ( isCopilot && ! ( copilotApplications
177
- && copilotApplications . length === 0
180
+ infoComponent = { ( isCopilot && ! ( appliedCopilotApplications
181
+ && appliedCopilotApplications . length === 0
178
182
) && opportunity ?. status === 'active' && ! ! application ) && (
179
183
< div className = { styles . applied } >
180
184
< IconSolid . CheckCircleIcon className = { styles . appliedIcon } />
0 commit comments