Skip to content

fix: show success message on bug report submission - #1512

Closed
eran132 wants to merge 1 commit into
hasadna:mainfrom
eran132:fix/bug-report-form
Closed

fix: show success message on bug report submission#1512
eran132 wants to merge 1 commit into
hasadna:mainfrom
eran132:fix/bug-report-form

Conversation

@eran132

@eran132 eran132 commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

The bug report form showed an error message even when the GitHub issue was created successfully. The onSuccess handler checked response.data?.state === 'open' which didn't match the actual API response structure.

  • Removed the strict state === 'open' check — form now resets on any successful API call
  • Show success alert even when the issue URL isn't available in the response (fallback message)
  • Users will no longer see a false error and submit duplicate reports

Closes #1431

Test plan

  • TypeScript compiles clean
  • ESLint + Prettier pass
  • Unit tests pass (9/9)
  • Existing Playwright tests cover success submission (mocked API returns 200 → success alert visible)
  • Existing Playwright tests cover error submission (mocked API returns 500 → error alert visible)
  • Existing Playwright tests cover missing field validation

Note: tests/bugReport.spec.ts already has E2E tests for both success (bug submission success) and error (bug submission server error) use cases with mocked backend endpoints.

🤖 Generated with Claude Code

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 hasadna#1431

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@eran132
eran132 requested a review from AvivAbachi as a code owner April 15, 2026 12:45
Copilot AI review requested due to automatic review settings April 15, 2026 12:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes the bug report form UX by ensuring a success state is shown after a successful GitHub issue creation request, without relying on an incorrect response.data.state === 'open' check.

Changes:

  • Reset the AntD form on any successful mutation (removed state === 'open' gate).
  • Always show a success Alert on mutation.isSuccess, with a fallback message when the issue URL is missing.
  • Keep the “view issue” link behavior when a URL is available.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</a>
{mutation.data?.data?.url ? (
<a href={mutation.data.data.url} target="_blank" rel="noopener noreferrer">
{t('reportBug.viewIssue')} (Github)

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

The link label uses "Github"; the correct brand capitalization is "GitHub" (and other strings in the repo use "GitHub"). Please update the text to avoid inconsistent UI copy.

Suggested change
{t('reportBug.viewIssue')} (Github)
{t('reportBug.viewIssue')} (GitHub)

Copilot uses AI. Check for mistakes.
{t('reportBug.viewIssue')} (Github)
</a>
) : (
t('reportBug.success', { defaultValue: 'Bug report submitted successfully!' })

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

t('reportBug.success', { defaultValue: ... }) hardcodes an English fallback even though reportBug.success is already defined in the locale JSON files. Consider using t('reportBug.success') to keep the message fully controlled by translations (and avoid accidental English text in non-English locales if the key changes).

Suggested change
t('reportBug.success', { defaultValue: 'Bug report submitted successfully!' })
t('reportBug.success')

Copilot uses AI. Check for mistakes.
@NoamGaash

Copy link
Copy Markdown
Member

Hi Eran! Thank you for your contribution.
I didn't have a time to review it manually yet, here's what Claude has to say:

The fix is correct. The original code had response.data?.state === 'open' which apparently never matched the actual API response shape, so the form never reset and no success message appeared.

One minor issue: the fallback string uses t('reportBug.success', { defaultValue: 'Bug report submitted successfully!' }) — the key reportBug.success doesn't exist in any translation file yet, so all languages will show the hardcoded English fallback. Fine as a quick fix, but worth a follow-up to add the translation key.

I hope I'll have the time to review it myself this weekend. Meanwhile, please make sure that your code is well-written and tested.
And again - thank you!
Noam

@NoamGaash NoamGaash left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You have mentioned a "Test plan" in your PR description and it seems like you didn't finish testing - please complete your PR and ask for a review once you feel it's ready.
Personally, I'd love to see a Playwright tests here that mocks the backend endpoint and cover both successful form submission and error use case. We can even make a visual test out of it.
Thanks!

@eran132

eran132 commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator Author

Great idea @NoamGaash — I'll add Playwright tests that mock the backend endpoint and cover both successful form submission and error cases. Will update this PR.

@eran132

eran132 commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator Author

Re-submitting from upstream branch (not fork) so previews and visual tests can run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

באג עבור שליחת הטופס הזה

3 participants