Skip to content

Commit 21331e0

Browse files
authored
Merge pull request #1351 from topcoder-platform/pm-3090
fix(PM-3090): likes dislikes not updated automatically
2 parents 32af683 + 32c3ea6 commit 21331e0

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

src/apps/review/src/lib/components/Scorecard/ScorecardViewer/ScorecardQuestion/AiFeedback/AiFeedback.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ const AiFeedback: FC<AiFeedbackProps> = props => {
4040
await createFeedbackComment(workflowId as string, workflowRun?.id as string, feedback?.id, {
4141
content,
4242
})
43-
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items`)
43+
await mutate(`
44+
${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]
45+
`)
4446
setShowReply(false)
4547
}, [workflowId, workflowRun?.id, feedback?.id])
4648

src/apps/review/src/lib/components/Scorecard/ScorecardViewer/ScorecardQuestion/AiFeedbackActions/AiFeedbackActions.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ export const AiFeedbackActions: FC<AiFeedbackActionsProps> = props => {
136136
}
137137

138138
try {
139-
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items`
139+
// eslint-disable-next-line max-len
140+
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items?[${workflowRun?.status}]`
140141
mutate(itemsKey, (items: any) => {
141142
if (!items || !Array.isArray(items)) return items
142143

@@ -202,7 +203,8 @@ export const AiFeedbackActions: FC<AiFeedbackActionsProps> = props => {
202203
setUpVotes(prevUp)
203204
setDownVotes(prevDown)
204205

205-
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items`
206+
// eslint-disable-next-line max-len
207+
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items?[${workflowRun?.status}]`
206208
await mutate(itemsKey)
207209
} finally {
208210
setVotingInprogress(false)
@@ -262,7 +264,8 @@ export const AiFeedbackActions: FC<AiFeedbackActionsProps> = props => {
262264
downVote: down,
263265
upVote: up,
264266
})
265-
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items`)
267+
// eslint-disable-next-line max-len
268+
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
266269
} catch (err) {
267270
setUserVote(prevUserVote)
268271
setUpVotes(prevUp)

src/apps/review/src/lib/components/Scorecard/ScorecardViewer/ScorecardQuestion/AiFeedbackComments/AiFeedbackComment.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,19 @@ export const AiFeedbackComment: FC<AiFeedbackCommentProps> = props => {
3636
content,
3737
parentId: comment.id,
3838
})
39-
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items`)
39+
await mutate(`
40+
${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]
41+
`)
4042
setShowReply(false)
4143
}, [workflowId, workflowRun?.id, props.feedback?.id])
4244

4345
const onEditReply = useCallback(async (content: string, comment: AiFeedbackCommentType) => {
4446
await updateRunItemComment(workflowId as string, workflowRun?.id as string, props.feedback?.id, comment.id, {
4547
content,
4648
})
47-
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items`)
49+
await mutate(`
50+
${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]
51+
`)
4852
setEditMode(false)
4953
}, [workflowId, workflowRun?.id, props.feedback?.id])
5054

0 commit comments

Comments
 (0)