Skip to content

Conversation

@dcoa
Copy link
Contributor

@dcoa dcoa commented Oct 27, 2025

Toast Notification for Feedback

Surface errors via toasts while keeping the modal open. This ensures they can retry or correct input without losing context, improving usability and reducing frustration.

Note

This PR needs to be rebased after #25 is merged.
I'm working in the coverage but decided to open because is a quite large and complex PR.

Changes:

  • Add team member (single or multiple entries).
  • Add role (single entry).
  • On save failure: show toast in page context, keep modal open.
  • Disable primary action while request is in flight to prevent duplicate calls.
  • On success: close modal, refresh view, show success toast.

Error Handling:

  • Transient errors (Retryable): 500, 502, 5XX generic, 503, timeout, generic server failure
    • Toast shows Retry, modal remains open
    • Retry disables while request is in flight, sends a single retry request
    • Validation errors (Non-retryable): user not found, mixed multiple entries
    • Toast summarizes counts (e.g., 2 added, 1 not found)
    • Modal remains open, failed entries retained for correction

Evidence

Screencast.from.2025-10-29.00-05-31.webm

Test Instructions

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Oct 27, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 27, 2025

Thanks for the pull request, @dcoa!

This repository is currently maintained by @openedx/committers-frontend.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Oct 27, 2025
@dcoa dcoa force-pushed the dcoa/error-toast branch from 56b4d17 to 2008811 Compare October 27, 2025 16:46
@dcoa dcoa changed the title feat(authz): Manage action feedback through Toast component feat(authz): [FC-0099] Manage action feedback using the Toast component. Oct 28, 2025
@dcoa dcoa force-pushed the dcoa/error-toast branch from 2008811 to f4ef82a Compare October 28, 2025 01:55
@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 94.81481% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.32%. Comparing base (9fef270) to head (ea8ea6b).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
.../AddNewTeamMemberModal/AddNewTeamMemberTrigger.tsx 94.11% 3 Missing ⚠️
.../libraries-manager/components/PublicReadToggle.tsx 80.00% 2 Missing ⚠️
...z-module/libraries-manager/ToastManagerContext.tsx 97.14% 1 Missing ⚠️
...e/libraries-manager/components/TeamTable/index.tsx 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #26      +/-   ##
==========================================
+ Coverage   94.14%   94.32%   +0.17%     
==========================================
  Files          44       44              
  Lines         837      881      +44     
  Branches      169      177       +8     
==========================================
+ Hits          788      831      +43     
- Misses         47       48       +1     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dcoa dcoa force-pushed the dcoa/error-toast branch 3 times, most recently from 8ce7d07 to 8a110d6 Compare October 28, 2025 12:13
@dcoa dcoa marked this pull request as ready for review October 28, 2025 13:09
@dcoa dcoa force-pushed the dcoa/error-toast branch from 7cc00a4 to d70f842 Compare October 28, 2025 13:24
@arbrandes
Copy link

Reviewing.

Copy link

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

I tested it and it works, good work!

However, I'm going to wait to do a proper code review once #25 merges and this is rebased on it, since many of the commits here are shared with it.

<Fragment key={`authz-header-action-${key}`}>
{content}
{(index === actions.length - 1) ? null
: (<hr className="border-right mx-5" style={{ height: '30px' }} />)}

Choose a reason for hiding this comment

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

This hard-coded height is going to be addressed by #25, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it has been addressed there

@brian-smith-tcril
Copy link

@dcoa I merged #25 so this should be ready for a rebase!

@dcoa dcoa force-pushed the dcoa/error-toast branch from 371585a to ea8ea6b Compare October 29, 2025 21:03
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Oct 29, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to In Eng Review in Contributions Oct 29, 2025
Copy link

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

Thanks for the rebase! As before, this is working well. I did have a change request, though. See comment below.


// Loading indicator should be visible in the modal
expect(screen.getByTestId('loading-indicator')).toBeInTheDocument();
const userInput = screen.getByTestId('users-input');

Choose a reason for hiding this comment

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

Can we please avoid getByTestId, findByTestId, and the like, if possible? This applies here and elsewhere in this PR. Let me know if it's not possible, in any given instance, as I'd be curious to understand why. Thanks!

Copy link

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

Given that 1) this PR actually works well, 2) the change request does not affect a user facing feature, 3) @dcoa is on the other side of the world, and 4) the Ulmo cut is in one hour, I'm electing to merge this under the assumption that a follow-up PR be issued to fix the getByTestIds.

👍🏼

@arbrandes arbrandes merged commit a9f8680 into openedx:master Oct 30, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from In Eng Review to Done in Contributions Oct 30, 2025
@arbrandes arbrandes mentioned this pull request Oct 30, 2025
@brian-smith-tcril brian-smith-tcril linked an issue Nov 3, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add feedback when trying to add a role a user already has

5 participants