Skip to content

Displayed an error message when the export modal image fails to load - #1841

Open
danielrafailov wants to merge 2 commits into
Courseography:masterfrom
danielrafailov:show-export-image-error
Open

danielrafailov wants to merge 2 commits into
Courseography:masterfrom
danielrafailov:show-export-image-error

Conversation

@danielrafailov

@danielrafailov danielrafailov commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Proposed Changes

Follow-up to #1838, as discussed there. When the request for the exported image fails, the Export modal shows no feedback: the error callbacks in getGraphImage and getGridImage only throw "No image generated". That throw happens inside a jQuery callback, so nothing catches it, and the modal stays blank or keeps showing the image from the last time it was opened.

Changes:

  • export.tsx:
    • ExportModal now tracks an error state. If the /image or /timetable-image request fails, it clears the stale image and sets a message ("The graph image could not be generated. Please try again." or "The timetable image could not be generated. Please try again."). The throw is removed. A successful request clears the error.
    • Added a small ImageError component that renders the message (with role="alert" so screen readers announce it) where the image would go. GraphImage and GridImage render it.
    • If "Switch Sessions" fails, the session isn't toggled, so clicking it again retries the same session.
  • app.scss: added an .export-image-error style that uses the existing --invalid-color.
  • Tests: added tests to ExportModal.test.js checking that a failed request shows the error message and no image on the graph and grid pages, that a failure replaces a previously loaded image, and that the message goes away once a later request succeeds.
Screenshots of your changes (if applicable)

Export modal (Graph) before the change:
Screenshot 2026-11-25 at 9 17 18 AM
Export modal (Graph) after the change:
Screenshot 2026-11-25 at 9 15 08 AM
Export modal (Grid) before the change:
Screenshot 2026-11-25 at 9 32 23 AM
Export modal (Grid) after the change:
Screenshot 2026-11-25 at 9 31 28 AM

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
✨ New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue) X
🎨 User interface change (change to user interface; provide screenshots) X
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.
  • I have updated the project Changelog (this is required for all changes).

After opening your pull request:

  • I have verified that the CI checks have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

  • The PDF and ICS downloads (getPDF, getCalendar) also only throw in their error callbacks. I left them alone to keep this PR focused, but I can handle them the same way in a follow-up if you'd like.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coveralls

coveralls commented Nov 25, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 45634560177

Coverage increased (+0.1%) to 62.328%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: 10 of 10 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4311
Covered Lines: 2730
Line Coverage: 63.33%
Relevant Branches: 1006
Covered Branches: 584
Branch Coverage: 58.05%
Branches in Coverage %: Yes
Coverage Strength: 158.55 hits per line

💛 - Coveralls

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants