Skip to content

Render native add-component strip for generic container XBlocks - #3058

Merged
bradenmacdonald merged 11 commits into
openedx:masterfrom
salman2013:salman/fix-container-block
Jul 23, 2026
Merged

bradenmacdonald merged 11 commits into
openedx:masterfrom
salman2013:salman/fix-container-block

Conversation

@salman2013

@salman2013 salman2013 commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Note: The changes in this PR is generated by Claude Sonet 4.6, reviewed by Salman. Based on the implementation plan suggested on the original ticket (#2620)

Details for the original bug can be found here: #2620

The backend (openedx-platform) dependent PR for this change: openedx/openedx-platform#38636

Settings

EDX_PLATFORM_REPOSITORY: https://github.com/openedx/openedx-platform.git
EDX_PLATFORM_VERSION: salman/fix-container-block

OPENEDX_EXTRA_PIP_REQUIREMENTS:
- xblock-problem-builder

@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 May 12, 2026
@openedx-webhooks

openedx-webhooks commented May 12, 2026 •

Copy link
Copy Markdown

Thanks for the pull request, @salman2013!

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 May 12, 2026
@salman2013 salman2013 changed the title chore: render native add-component strip for generic container XBlocks Render native add-component strip for generic container XBlocks May 12, 2026
@codecov

codecov Bot commented May 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.82609% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.78%. Comparing base (0c864d9) to head (70536b9).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
...ponent/add-component-modals/ComponentModalView.tsx 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3058      +/-   ##
==========================================
+ Coverage   95.70%   95.78%   +0.08%     
==========================================
  Files        1401     1398       -3     
  Lines       33376    33465      +89     
  Branches     7568     7883     +315     
==========================================
+ Hits        31941    32056     +115     
+ Misses       1388     1365      -23     
+ Partials       47       44       -3     

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

@kdmccormick

Copy link
Copy Markdown
Member

The general approach on both this PR and the openedx-platform PR look good to me!

When you're ready, can you make a sandbox for testing? You can make it on this PR, and use tutor configuration to point the backend at your openedx-platform branch:
https://github.com/open-craft/pr-sandbox-automation/tree/main/docs#1-tutor-configurations

@salman2013 salman2013 added the create-sandbox open-craft-grove should create a sandbox environment from this PR label May 13, 2026
@salman2013 salman2013 closed this May 13, 2026
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in Contributions May 13, 2026
@salman2013 salman2013 reopened this May 13, 2026
@salman2013

salman2013 commented May 13, 2026 •

Copy link
Copy Markdown
Contributor Author

@kdmccormick The sandbox has been created successfully if you could get a chance to take a look at it.
https://github.com/openedx/frontend-app-authoring/pull/3058/checks?check_run_id=75731943406

@salman2013
salman2013 marked this pull request as ready for review May 13, 2026 10:10
@salman2013
salman2013 requested review from farhan and kdmccormick May 13, 2026 10:28
@salman2013 salman2013 closed this May 14, 2026
@salman2013 salman2013 reopened this May 14, 2026
@salman2013 salman2013 closed this May 14, 2026
@salman2013 salman2013 reopened this May 14, 2026
@salman2013 salman2013 closed this May 14, 2026
@salman2013 salman2013 reopened this May 14, 2026
@salman2013 salman2013 closed this May 14, 2026
@salman2013 salman2013 reopened this May 14, 2026
@salman2013 salman2013 closed this May 14, 2026
@salman2013 salman2013 reopened this May 14, 2026
@bradenmacdonald

Copy link
Copy Markdown
Contributor

@salman2013 Why are you closing and re-opening this PR so many times?

Do you not have the "re-run checks" button in the UI on this page ?

Screenshot 2026-06-25 at 1 40 33 PM

Comment thread src/course-unit/add-component/add-component-btn/index.jsx Outdated
Comment thread src/course-unit/add-component/add-component-btn/index.jsx Outdated
Comment thread src/course-unit/add-component/add-component-modals/ComponentModalView.jsx Outdated
Comment thread src/course-unit/add-component/AddComponent.tsx
Comment thread src/course-unit/CourseUnit.tsx
Comment thread src/course-unit/hooks.tsx
updateQueryPendingStatus,
} from './data/slice';

export const useCourseUnit = ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: this can be fixed in a separate PR, but if this hook/component is used for split test, problem bank, and many other things, it shouldn't be called "CourseUnit" and should be called "CourseComponentContainer" or something more generic.

@salman2013

Copy link
Copy Markdown
Contributor Author

@salman2013 Why are you closing and re-opening this PR so many times?

Do you not have the "re-run checks" button in the UI on this page ?

Screenshot 2026-06-25 at 1 40 33 PM

@bradenmacdonald No, this option is not available on my side, may be just shown for maintainers.

@bradenmacdonald

Copy link
Copy Markdown
Contributor

@salman2013 Ah, that's too bad. Thanks for checking.

…eScript

- Replace defaultProps with ES6 function defaults in AddComponentButton and ComponentModalView
- Convert add-component-btn/index.jsx and ComponentModalView.jsx to TypeScript, removing propTypes
- Add JSDoc comment explaining isGenericContainerType in AddComponentProps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bradenmacdonald

Copy link
Copy Markdown
Contributor

Code looks fine to me now, thanks. I can review and merge once the platform PR is merged and the "patch" coverage is passing.

salman2013 and others added 2 commits June 30, 2026 14:07
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a default case to handleCreateNewXBlock that calls
handleCreateNewCourseXBlock with the block's type and category.
This allows custom/third-party block types declared via
StudioContainerWithNestedXBlocksMixin.allowed_nested_blocks
(e.g. ranged-value-freeform) to be created when the author
clicks their individual Add New Component button, instead of
silently doing nothing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@salman2013 salman2013 closed this Jul 2, 2026
@salman2013 salman2013 reopened this Jul 2, 2026
@kdmccormick

Copy link
Copy Markdown
Member

The Platform PR is merged now 🚀 @salman2013 , could you get the patch coverage up to 95.7%, and then request Braden for a final review?

@kdmccormick
kdmccormick removed their request for review July 8, 2026 11:44
salman2013 and others added 3 commits July 9, 2026 12:32
…omponent features

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@salman2013

Copy link
Copy Markdown
Contributor Author

@bradenmacdonald Could you please review the PR? I added a few tests for the new changes, but the patch coverage is still 0.5% below the target. Could you take a look and let me know if this is acceptable for merging the PR?

@bradenmacdonald

Copy link
Copy Markdown
Contributor

@salman2013 Sorry for the delay; I'll try to review soon.

@bradenmacdonald

Copy link
Copy Markdown
Contributor

This looks great. The only issue I found is again with the problem builder block. It has these three buttons which all add a pb-message block but with different boilerplate templates. However, the template/boilerplate is being ignored by these new add buttons, so clicking on any of them only adds a "Message (complete)"; it's not possible to add "Message (incomplete)" nor "Message (Max # of attempts)".

I think this would affect other XBlocks that use templates as well, but I'm not sure if any still do that. The problem block used to use templates but that has been replaced by a new system in the new problem editor.

Screenshot 2026-07-20 at 5 28 47 PM

If you want, we can merge this PR anyways and address the templates in a follow-up PR, as this still fixes 90% of the problem.

@salman2013

Copy link
Copy Markdown
Contributor Author

@bradenmacdonald I am more comfortable merging this PR, as this has fixed 90% of the problem, and creating a follow-up PR to fix the mentioned issue. The reason is that this ticket has been on board for so long.
I need to look more into this thing

I think this would affect other XBlocks that use templates as well, but I'm not sure if any still do that. The problem block used to use templates but that has been replaced by a new system in the new problem editor.

If you think its safe approach, we can proceed to merge this.

@bradenmacdonald

Copy link
Copy Markdown
Contributor

@salman2013 Sorry, I just checked and I don't have permission to override the patch check. You'll need to fix the patch coverage before I can merge.

The only thing that's not being tested is the default value disabled = False, because we're always passing an explicit disabled={true} or disabled={false} to <AddComponentButton /> and the default value is never exercised. This is a pretty dumb thing for the coverage check to be complaining about, but that's how coverage checking works.

You can try adding // istanbul ignore next: we always set this explicitly at the moment on the line above disabled = False and see if that fixes it. Or just remove the default and require disabled to always be specified explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@salman2013

Copy link
Copy Markdown
Contributor Author

@bradenmacdonald Thanks for looking into the PR and guiding to fix the patch coverage. I have fixed the mentioned test, and now the patch coverage is green.

@bradenmacdonald
bradenmacdonald merged commit 7680117 into openedx:master Jul 23, 2026
7 of 8 checks passed
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). create-sandbox open-craft-grove should create a sandbox environment from this PR open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants