Skip to content

Commit dbcb048

Browse files
committed
Let the form reset clear chat feedback details
conversation.spec failed on every run since the chat lane landed: making the field controlled meant a form reset no longer emptied it. The value now comes from the form when it submits, and the field still unmounts with the dialog.
1 parent 521e8f5 commit dbcb048

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

‎apps/sim/platform/app/(shell)/_components/chat/message/response-actions.tsx‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export function ResponseActions({ turn }: ResponseActionsProps) {
2727
const { rate, fork } = useChatHandlers()
2828
const [feedback, setFeedback] = useState<Rating | null>(null)
2929
const [rating, setRating] = useState<Rating | null>(null)
30-
const [details, setDetails] = useState('')
3130
return (
3231
<>
3332
<div className={styles.responseActions} data-type='T060'>
@@ -56,16 +55,13 @@ export function ResponseActions({ turn }: ResponseActionsProps) {
5655
variant='feedback'
5756
open={feedback !== null}
5857
onOpenChange={(open) => {
59-
if (!open) {
60-
setFeedback(null)
61-
setDetails('')
62-
}
58+
if (!open) setFeedback(null)
6359
}}
6460
title='Share feedback'
6561
description='What could Sim have done better?'
6662
confirmLabel='Send feedback'
67-
onConfirm={async () => {
68-
const written = details.trim()
63+
onConfirm={async (values) => {
64+
const written = String(values.get('details') ?? '').trim()
6965
// An empty details field sends nothing, as the rating alone means little to read.
7066
if (rate && written && turn.userQuery && feedback) {
7167
await rate({
@@ -77,7 +73,6 @@ export function ResponseActions({ turn }: ResponseActionsProps) {
7773
}
7874
setRating(feedback)
7975
setFeedback(null)
80-
setDetails('')
8176
}}
8277
>
8378
{feedback && (
@@ -100,8 +95,7 @@ export function ResponseActions({ turn }: ResponseActionsProps) {
10095
label='Details'
10196
placeholder='Tell us what was missing or how the response could improve.'
10297
density='expanded'
103-
value={details}
104-
onChange={setDetails}
98+
name='details'
10599
/>
106100
</FieldFrame>
107101
{turn.requestId && <CopyField label='Request ID' value={turn.requestId} />}

0 commit comments

Comments
 (0)