Skip to content

fix: too many toast errors in no project access state #36698

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

a-lider
Copy link
Contributor

@a-lider a-lider commented Aug 15, 2025

Problem

Users with no access to any project get flooded with error toasts.
Screenshot 2025-08-15 at 13 20 05

Changes

  • Suppress toast errors for 403 responses coming from loaders. Rely on the existing Access Denied UI states (ErrorProjectUnavailable / ErrorAccessDenied).
  • This seems more maintainable and consistent than adding try/catch 403 handling in every logic
Screenshot 2025-08-15 at 13 24 42

How did you test this code?

Manually

Copy link
Contributor

Size Change: 0 B

Total Size: 2.68 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 2.68 MB

compressed-size-action

@a-lider a-lider requested a review from zlwaterfield August 15, 2025 13:47
@a-lider a-lider marked this pull request as ready for review August 15, 2025 14:02
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR fixes a UX issue where users with restricted project access were being overwhelmed with toast error notifications. The change modifies the global error handler in frontend/src/initKea.ts to suppress toast notifications for 403 (Forbidden) responses that come specifically from loader actions (methods starting with "load", "get", or "fetch").

The implementation adds a regex pattern /^(load|get|fetch)[A-Z]/ to identify loader actions and excludes them from showing toast errors when they receive 403 status codes. Instead of displaying multiple error toasts, the application relies on existing dedicated UI error states like ErrorProjectUnavailable and ErrorAccessDenied components to handle access denied scenarios.

This centralized approach is more maintainable than adding individual try/catch blocks throughout the codebase for every potential 403 error. The change follows the existing pattern where specific error types (like 401 for authentication) are handled by dedicated systems rather than generic toast notifications. The regex specifically targets loader actions because these are the primary operations that fail with 403 when users lack project access, while preserving toast notifications for 403 errors from other types of operations where they might still be appropriate.

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it addresses a specific UX issue with a targeted solution
  • Score reflects a well-thought-out centralized approach that maintains consistency with existing error handling patterns
  • No files require special attention as the change is localized and follows established conventions

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

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.

1 participant