Skip to content

Commit ca06ce4

Browse files
committed
fix: likes dislikes not updated automatically
1 parent 32af683 commit ca06ce4

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ 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(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
4444
setShowReply(false)
4545
}, [workflowId, workflowRun?.id, feedback?.id])
4646

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

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

138138
try {
139-
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items`
139+
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items?[${workflowRun?.status}]`
140140
mutate(itemsKey, (items: any) => {
141141
if (!items || !Array.isArray(items)) return items
142142

@@ -202,7 +202,7 @@ export const AiFeedbackActions: FC<AiFeedbackActionsProps> = props => {
202202
setUpVotes(prevUp)
203203
setDownVotes(prevDown)
204204

205-
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items`
205+
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items?[${workflowRun?.status}]`
206206
await mutate(itemsKey)
207207
} finally {
208208
setVotingInprogress(false)
@@ -262,7 +262,7 @@ export const AiFeedbackActions: FC<AiFeedbackActionsProps> = props => {
262262
downVote: down,
263263
upVote: up,
264264
})
265-
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items`)
265+
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
266266
} catch (err) {
267267
setUserVote(prevUserVote)
268268
setUpVotes(prevUp)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@ 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(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
4040
setShowReply(false)
4141
}, [workflowId, workflowRun?.id, props.feedback?.id])
4242

4343
const onEditReply = useCallback(async (content: string, comment: AiFeedbackCommentType) => {
4444
await updateRunItemComment(workflowId as string, workflowRun?.id as string, props.feedback?.id, comment.id, {
4545
content,
4646
})
47-
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items`)
47+
console.log(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
48+
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
4849
setEditMode(false)
4950
}, [workflowId, workflowRun?.id, props.feedback?.id])
5051

0 commit comments

Comments
 (0)