Skip to content

fix(dashboards): Update error toast with message #92437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

narsaynorath
Copy link
Member

The error toasts were putting up generic messages. Update the toasts so the user doesn't have to look at the network tab to explain their problem.

This fix is applied to Discover, where at the moment is:unresolved results in an error when trying to save a query or save as a homepage. In dashboards this fixes the toast to pick the first error message to display in the toast. This isn't ideal, it would be better if the message appeared with the specific field in the form but for now I wanted to make a quick improvement.

The error toasts were putting up generic messages. Update the toasts so
the user doesn't have to look at the network tab to explain their
problem.
@narsaynorath narsaynorath requested review from a team as code owners May 28, 2025 19:54
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 28, 2025

if ('responseJSON' in e) {
const response = e.responseJSON;
if (response?.non_field_errors && Array.isArray(response.non_field_errors)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is very special cased right now, but we can expand it out for other errors. I just know this is what the error for the is: filter looks like.

Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #92437      +/-   ##
==========================================
- Coverage   78.86%   74.16%   -4.71%     
==========================================
  Files       10226    10226              
  Lines      585940   585936       -4     
  Branches    22761    22760       -1     
==========================================
- Hits       462120   434572   -27548     
- Misses     120401   147946   +27545     
+ Partials     3419     3418       -1     

Copy link
Member

@nikkikapadia nikkikapadia left a comment

Choose a reason for hiding this comment

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

sweeetttt

@narsaynorath narsaynorath merged commit 33c27e8 into master May 29, 2025
42 checks passed
@narsaynorath narsaynorath deleted the nar/fix/dashboards-message-user-for-invalid-state branch May 29, 2025 16:09
andrewshie-sentry pushed a commit that referenced this pull request Jun 2, 2025
The error toasts were putting up generic messages. Update the toasts so
the user doesn't have to look at the network tab to explain their
problem.

This fix is applied to Discover, where at the moment `is:unresolved`
results in an error when trying to save a query or save as a homepage.
In dashboards this fixes the toast to pick the first error message to
display in the toast. This isn't ideal, it would be better if the
message appeared with the specific field in the form but for now I
wanted to make a quick improvement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants