Skip to content

Conversation

ChrisChV
Copy link
Contributor

@ChrisChV ChrisChV commented Jul 23, 2025

Description

  • Adds the sync button on section/subsection cards
  • Which user roles will this change impact? "Course Author".
image

Supporting information

Testing instructions

  • Create a new library and a new course.
  • In the library, you need to create this nested structure: Section > Subsection > Unit > Component.
  • Publish the library.
  • In the course:
    • Import the Section from the library.
    • Create a simple Section. In this section:
      • Import the Subsection from the library.
      • Create a simple Subsection. In this subsection:
        • Import the Unit from the library.
        • Create a simple Unit. In this unit:
          • Import the Component from the library.
  • Go to the library, update the Section name, and publish it.
  • Go to the course outline. Verify that you can see the sync button in the section card. Sync the section.
  • Go to the library, update the Subsection name, and publish it.
  • Go to the course outline. Verify that you can see
    • The sync button in the Section card; that is the top-level parent of the subsection.
    • The sync button in the Subsection card; that was imported on its own.
  • Sync all.
  • Go to the library, update the Unit name, and publish it.
  • Go to the course outline. Verify that you can see:
    • The sync button in the Section card; that is the top-level parent when importing the section.
    • The sync button in the Subsection card; that is the top-level parent when importing the subsection.
    • The sync button in the Unit card; that was imported on its own.
  • Go to the library, update the Component name, and publish it.
  • Go to the course outline. Verify that you can see:
    • The sync button in the Section card; that is the top-level parent when importing the section.
    • The sync button in the Subsection card; that is the top-level parent when importing the subsection.
    • The sync button in the Unit card; that is the top-level parent when importing the unit.
    • The sync button in the Component card, which was imported on its own.
  • Go to the library, update the Subsection name, and publish it.
  • Go to the course outline. Ignore the changes to the Section card. Verify that the sync button is gone.

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).
  • Deprecated propTypes, defaultProps, and injectIntl patterns are not used 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.
  • Imports avoid using ../. 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 Jul 23, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Jul 23, 2025

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.


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.

@ChrisChV ChrisChV changed the title feat: show sync button on section/subsections feat: show sync button on section/subsections [FC-0097] Jul 23, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Jul 23, 2025
@ChrisChV ChrisChV marked this pull request as draft July 23, 2025 21:08
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.55%. Comparing base (7825bcd) to head (e2971f0).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2324      +/-   ##
==========================================
+ Coverage   94.50%   94.55%   +0.05%     
==========================================
  Files        1171     1174       +3     
  Lines       25149    25366     +217     
  Branches     5374     5570     +196     
==========================================
+ Hits        23766    23984     +218     
+ Misses       1320     1313       -7     
- Partials       63       69       +6     

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

@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Jul 28, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Jul 28, 2025
Copy link
Contributor

@navinkarkera navinkarkera left a comment

Choose a reason for hiding this comment

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

@ChrisChV Nice work 👍. Just left a suggestion about invalidating course library queries.

@@ -148,6 +165,10 @@ const SectionCard = ({
setIsExpanded((prevState) => containsSearchResult() || prevState);
}, [locatorId, setIsExpanded]);

const handleOnPostChangeSync = useCallback(() => {
dispatch(fetchCourseSectionQuery([section.id]));
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to invalidate course libraries query after syncing changes. Same for Subsection and unit cards.

Vice versa, we need to refetch course section when the sync is performed from course libraries 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.

We need to invalidate course libraries query after syncing changes. Same for Subsection and unit cards.

Updated here: 6ebf564
That updates the counter in the warning.

Vice versa, we need to refetch course section when the sync is performed from course libraries page.

I'm not sure this is necessary. Does the course libraries page display any course information?

Copy link
Contributor

Choose a reason for hiding this comment

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

Does the course libraries page display any course information?

No, just wanted to make sure that the outline is updated and the sync button from the outline is removed. But it seems like the outline is refresh every time, so not needed.

Copy link
Contributor

@navinkarkera navinkarkera left a comment

Choose a reason for hiding this comment

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

@ChrisChV Looks good. 👍

  • I tested this: (Verified sync button in outline)
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@@ -148,6 +165,10 @@ const SectionCard = ({
setIsExpanded((prevState) => containsSearchResult() || prevState);
}, [locatorId, setIsExpanded]);

const handleOnPostChangeSync = useCallback(() => {
dispatch(fetchCourseSectionQuery([section.id]));
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the course libraries page display any course information?

No, just wanted to make sure that the outline is updated and the sync button from the outline is removed. But it seems like the outline is refresh every time, so not needed.

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

LGTM

@ChrisChV ChrisChV enabled auto-merge (squash) August 21, 2025 21:35
@ChrisChV ChrisChV merged commit 0c88fd6 into openedx:master Aug 21, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from Waiting on Author to Done in Contributions Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants