Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const AiFeedback: FC<AiFeedbackProps> = props => {
await createFeedbackComment(workflowId as string, workflowRun?.id as string, feedback?.id, {
content,
})
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items`)
await mutate(`
${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]
`)
setShowReply(false)
}, [workflowId, workflowRun?.id, feedback?.id])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export const AiFeedbackActions: FC<AiFeedbackActionsProps> = props => {
}

try {
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items`
// eslint-disable-next-line max-len
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items?[${workflowRun?.status}]`

Choose a reason for hiding this comment

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

[❗❗ correctness]
The use of optional chaining with workflowRun?.status in the URL may lead to unexpected behavior if workflowRun is undefined. Consider ensuring workflowRun is defined before constructing the URL to avoid potential issues.

mutate(itemsKey, (items: any) => {
if (!items || !Array.isArray(items)) return items

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

const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items`
// eslint-disable-next-line max-len
const itemsKey = `${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items?[${workflowRun?.status}]`
await mutate(itemsKey)
} finally {
setVotingInprogress(false)
Expand Down Expand Up @@ -262,7 +264,8 @@ export const AiFeedbackActions: FC<AiFeedbackActionsProps> = props => {
downVote: down,
upVote: up,
})
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun.id}/items`)
// eslint-disable-next-line max-len
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
} catch (err) {
setUserVote(prevUserVote)
setUpVotes(prevUp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@ export const AiFeedbackComment: FC<AiFeedbackCommentProps> = props => {
content,
parentId: comment.id,
})
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items`)
await mutate(`
${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]
`)
setShowReply(false)
}, [workflowId, workflowRun?.id, props.feedback?.id])

const onEditReply = useCallback(async (content: string, comment: AiFeedbackCommentType) => {
await updateRunItemComment(workflowId as string, workflowRun?.id as string, props.feedback?.id, comment.id, {
content,
})
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items`)
await mutate(`
${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]
`)
setEditMode(false)
}, [workflowId, workflowRun?.id, props.feedback?.id])

Expand Down
Loading