Skip to content

Missing toast notification when grouped export format is unavailable #30

@vprashrex

Description

@vprashrex

Describe the bug
When selecting "Grouped (by Question)" export format on the evaluation detail page, if the backend returns an error indicating grouped format is not available for that evaluation, no toast notification is shown to the user. The error is silently ignored because the backend returns HTTP 200 with success: false, which the frontend was not checking.

To Reproduce

  • Go to an evaluation detail page (/evaluations/[id])
  • Change the export format dropdown from "Row (Individual)" to "Grouped (by Question)"
  • The backend returns { success: false, error: "Grouped export format is not available for this evaluation." } with HTTP 200
  • No toast/error message is shown to the user

Expected behavior
A toast notification should appear informing the user that grouped export format is not available for this evaluation and needed to upload a new dataset. The format selector should revert back to "Row (Individual)".

Screenshots
N/A

Additional context
The root cause was that the frontend only checked response.ok (HTTP status) but the backend returns HTTP 200 even when success: false. The fix adds a check for data.success === false && data.error after parsing the JSON response, shows a toast with the error message, and reverts the dropdown to "Row".

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions