Skip to content

Commit ddb012e

Browse files
eran132claude
andcommitted
fix: show success message on bug report submission
The form showed an error even when the GitHub issue was created successfully, because onSuccess checked response.data?.state === 'open' which didn't match the actual API response shape. Now the form resets and shows success on any successful API call, with a fallback message when the issue URL isn't available in the response. Closes #1431 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 363519b commit ddb012e

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/pages/bugReport/BugReportForm.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ const BugReportForm = () => {
1919
const mutation = useMutation({
2020
mutationFn: (values: CreateIssuePostRequest) =>
2121
ISSUES_API.issuesCreatePost({ createIssuePostRequest: values }),
22-
onSuccess: (response) => {
23-
if (response.data?.state === 'open') {
24-
form.resetFields()
25-
// setFileList([])
26-
}
22+
onSuccess: () => {
23+
form.resetFields()
2724
},
2825
onError: (error) => {
2926
console.error('Error submitting bug report:', error)
@@ -62,11 +59,15 @@ const BugReportForm = () => {
6259
</p>
6360
}>
6461
<span>{t('reportBug.description')}</span>
65-
{mutation.isSuccess && mutation.data?.data && (
62+
{mutation.isSuccess && (
6663
<Alert severity="success" sx={{ marginBottom: 2 }}>
67-
<a href={mutation.data.data.url} target="_blank" rel="noopener noreferrer">
68-
{t('reportBug.viewIssue')} (Github)
69-
</a>
64+
{mutation.data?.data?.url ? (
65+
<a href={mutation.data.data.url} target="_blank" rel="noopener noreferrer">
66+
{t('reportBug.viewIssue')} (Github)
67+
</a>
68+
) : (
69+
t('reportBug.success', { defaultValue: 'Bug report submitted successfully!' })
70+
)}
7071
</Alert>
7172
)}
7273

0 commit comments

Comments
 (0)