Skip to content

refactor: Migrate processingNotification from redux store to use the functions in ToastContext#2917

Open
ChrisChV wants to merge 5 commits intoopenedx:masterfrom
open-craft:chris/redux-migration/proccessingNotification
Open

refactor: Migrate processingNotification from redux store to use the functions in ToastContext#2917
ChrisChV wants to merge 5 commits intoopenedx:masterfrom
open-craft:chris/redux-migration/proccessingNotification

Conversation

@ChrisChV
Copy link
Contributor

@ChrisChV ChrisChV commented Feb 27, 2026

Description

  • Migrates processingNotification from redux store to use the functions in ToastContext.
  • Involves some changes in these pages:
    • Certificates
    • Course Outline
    • Course Unit
    • Course Updates
    • Group Configuration
    • Textbooks
  • Which user roles will this change impact? "Developer".

Supporting information

Testing instructions

  • Create a new course.

Certificates

Course Outline

  • Go to the course outline
  • Test: Add containers, delete containers, move containers, duplicate containers, copy and paste units, save highlights.

Course Unit

  • Create a new unit in the course outline
  • Test: Rename unit, change unit visibility, create/delete/duplicate/move xblocks, copy and paste xblocks.

Course Updates

  • In the course outline, go to Content > Course updates.
  • Test: Create, update, delete updates and edit handouts.

Group Configuration

  • In the course outline, go to Settings > Group Configurations.
  • Test: Create, edit, delete content groups.

Textbooks

  • In the course outline, go to Content > Pages & resources > Textbooks
  • Test: Create, edit, delete textbooks.

Other information

N/A

Best Practices Checklist

We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:

  • Any new files are using TypeScript (.ts, .tsx).
  • Avoid propTypes and defaultProps in any new or modified code.
  • Tests should use the helpers in src/testUtils.tsx (specifically initializeMocks)
  • Do not add new fields to the Redux state/store. Use React Context to share state among multiple components.
  • Use React Query to load data from REST APIs. See any apiHooks.ts in this repo for examples.
  • All new i18n messages in messages.ts files have a description for translators to use.
  • Avoid using ../ in import paths. To import from parent folders, use @src, e.g. import { initializeMocks } from '@src/testUtils'; instead of from '../../../../testUtils'

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 27, 2026
@openedx-webhooks
Copy link

Thanks for the pull request, @ChrisChV!

This repository is currently maintained by @bradenmacdonald.

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 Feb 27, 2026
@ChrisChV ChrisChV changed the title refactor: Migrate processingNotification from redux store to use the functions in ToastContest refactor: Migrate processingNotification from redux store to use the functions in ToastContext Feb 27, 2026
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 98.24561% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.51%. Comparing base (5c1cdcf) to head (e4b41b6).

Files with missing lines Patch % Lines
src/course-outline/data/apiHooks.ts 94.11% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #2917    +/-   ##
========================================
  Coverage   95.51%   95.51%            
========================================
  Files        1329     1327     -2     
  Lines       30544    30557    +13     
  Branches     6941     6697   -244     
========================================
+ Hits        29173    29188    +15     
- Misses       1303     1313    +10     
+ Partials       68       56    -12     

☔ 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.

Comment on lines 42 to 43
// TODO, We can convert this to a queue of messages,
// see: https://github.com/open-craft/frontend-app-course-authoring/pull/38#discussion_r1638990647
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you interested in doing this now? I'm a little worried about all the closeToast() method calls potentially hiding error messages if we're using this context for so many different things.

e.g. Export says "show toast", then 1s later something else shows an error toast, then export calls "close toast" and the user never sees the middle error.

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, I can do it in a separate PR

closeToast: () => {},
});

// Module-level references to showToast and closeToast, kept in sync by ToastProvider.
Copy link
Contributor

Choose a reason for hiding this comment

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

We could just make these global variables then, instead of using a context provider.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bradenmacdonald In the comments, I forgot to mention that this is, in theory, temporary. These functions are used in thunks, which will be migrated to React Query. In the new functions, it will be possible to call useToastContext(). Furthermore, for more complex functions like the message queue, the context would be better. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

@ChrisChV OK, please mention that in a comment in the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated: e4b41b6

|| isSectionHighlightsUpdatePending
|| isDuplicatingItem
|| isPasting) {
showToast(NOTIFICATION_MESSAGES.saving);
Copy link
Contributor

Choose a reason for hiding this comment

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

This shows the toast, but it doesn't hide it when the processing is done, and I think the code before did that?

For example, if I add a new section to the course, it says "Saving" for 1 second and then I see the new section appear, but it still says "Saving" for a few more seconds, even though the new section is already fully created.

The unit page is working fine though; the problem is only on the outline page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's true. I refactored that code in dc730de

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Mar 3, 2026
@ChrisChV ChrisChV requested a review from bradenmacdonald March 3, 2026 21:04
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: Waiting on Author

Development

Successfully merging this pull request may close these issues.

3 participants