Skip to content

fix: show a toast when a grade import fails - #615

Open
Anas12091101 wants to merge 1 commit into
openedx:legacy-mfefrom
mitodl:fix/import-error-toast
Open

Anas12091101 wants to merge 1 commit into
openedx:legacy-mfefrom
mitodl:fix/import-error-toast

Conversation

@Anas12091101

@Anas12091101 Anas12091101 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR - A successful grade import shows a toast at the bottom of the Gradebook, but a failed one shows nothing there — the error only appears if you click through to the Bulk Management History screen. This adds an error toast so both outcomes are reported where the operator actually pressed Import.

JIRA: n/a

What changed?

  • New ImportErrorToast, shown on csvUpload.error, displaying whatever message the API returned rather than wording of its own — so it covers future error types without further frontend work.
  • The reducer clears both toasts on csvUpload.started, so one upload is never described by the previous one's result.
  • The toast holds for 15s instead of Paragon's 5s default, since the reader has to act on it. Paragon's Toast has no variant prop, so it is styled the same as the success toast and distinguished by its wording.
  • Dropped a stray trailing semicolon from the error banner text, and bulkImportError now composes the new bulkImportErrorMessages selector instead of duplicating its join logic.
grade-import-final-narrated.webm

Developer Checklist

  • Test suites passing
  • Documentation and test plan updated, if applicable
  • Received code-owner approving review
  • Bumped version number package.json

Testing Instructions

Needs the companion backend PR — openedx/edx-bulk-grades#178 — because on current master a file with nothing to apply is reported as a success, so there is no error for the toast to show.

  • Open the Gradebook for a course and click Download Grades.
  • Upload that file straight back without editing it. A toast should appear at the bottom saying the import failed and naming the new_override column.
  • Click View Bulk Management History on the toast — it should take you to that screen, where the same message appears.
  • Now put a number in one new_override column and upload again. You should get the usual success toast, and no error toast.

Reviewer Checklist

Collectively, these should be completed by reviewers of this PR:

  • I've done a visual code review
  • I've tested the new functionality

FYI: @openedx/content-aurora

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 9, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @Anas12091101!

This repository is currently maintained by @farhaanbukhsh.

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.

@codecov

codecov Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.14%. Comparing base (568914d) to head (abf66bb).

Additional details and impacted files
@@              Coverage Diff               @@
##           legacy-mfe     #615      +/-   ##
==============================================
+ Coverage       95.06%   95.14%   +0.07%     
==============================================
  Files             139      139              
  Lines            1357     1379      +22     
  Branches          266      274       +8     
==============================================
+ Hits             1290     1312      +22     
  Misses             59       59              
  Partials            8        8              

☔ View full report in Codecov by Harness.
📢 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.

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.

🟢 Approval recommended

The failure flow, state transitions, message formatting, navigation, and fallback behavior are coherent and adequately tested.

Pull request overview

Adds failure feedback for grade imports, complementing the companion backend behavior.

Changes:

  • Adds a 15-second import-error toast with API details and history navigation.
  • Coordinates success/error toast state across upload lifecycle events.
  • Refactors error formatting and expands tests.
File summaries
File Description
src/data/selectors/grades.test.js Tests error-message formatting.
src/data/selectors/grades.js Adds reusable error-message selector.
src/data/selectors/app.js Exposes error-toast state.
src/data/redux/hooks/selectors.js Adds selector hooks.
src/data/redux/hooks/actions.js Adds error-toast action hook.
src/data/reducers/app.test.js Tests toast state transitions.
src/data/reducers/app.js Manages mutually exclusive toast state.
src/data/actions/app.js Adds error-toast action.
src/components/GradesView/index.jsx Mounts the error toast.
src/components/GradesView/ImportErrorToast/messages.js Defines localized messages.
src/components/GradesView/ImportErrorToast/index.test.jsx Tests toast rendering.
src/components/GradesView/ImportErrorToast/index.jsx Implements the toast component.
src/components/GradesView/ImportErrorToast/hooks.test.js Tests toast behavior and content.
src/components/GradesView/ImportErrorToast/hooks.js Provides toast data and handlers.
Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Anas12091101
Anas12091101 force-pushed the fix/import-error-toast branch 3 times, most recently from 340dc3d to eb74ea3 Compare September 9, 2026 13:06
@Anas12091101
Anas12091101 requested a balanced review from Copilot September 9, 2026 13:08

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.

🟢 Approval recommended

The failure and success paths are consistently wired through Redux, safely rendered, and covered by focused tests.

Review details
  • Files reviewed: 18/18 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Sep 9, 2026
@arbrandes

Copy link
Copy Markdown
Contributor

With #621, master is now the frontend-base App Repository, and the micro-frontend tree this PR targets lives on the legacy-mfe branch (from which any further Open edX release branches are cut). Please retarget this PR at legacy-mfe; the fix remains relevant to Ulmo and Verawood users.

@Anas12091101
Anas12091101 changed the base branch from master to legacy-mfe October 8, 2026 11:09
@Anas12091101
Anas12091101 force-pushed the fix/import-error-toast branch from 8922a37 to abf66bb Compare October 8, 2026 11:11
@Anas12091101

Copy link
Copy Markdown
Contributor Author

@arbrandes sorry for the delay, I was on leave.

I have now retargeted this PR at legacy-mfe and rebased onto it.

Could you review this with openedx/edx-bulk-grades#178 when you get a chance?

@arbrandes

Copy link
Copy Markdown
Contributor

@Anas12091101, the bug also exists in master. Do you mind creating a PR for it? The policy is that we should fix bugs in master before any other branch.

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

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

5 participants