fix: restore add-component buttons for content experiment groups - #38997
Conversation
|
Thanks for the pull request, @Anas12091101! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
Tested manually and confirmed the fix works as described. Environment: Tutor dev (Python 3.12 image, current master baseline), split_test enabled in Advanced Module List, one Experiment Group Configuration (Group A / Group B) added to a course, rebuilt CMS webpack (npm run webpack-dev) to pick up container.js.
|
Description
Content experiments (
split_test) render no Add New Component panels in the authoring MFE, so Course Authors cannot add content to experiment groups at all. Regression from #38636, which narrowed the guard inrenderAddXBlockComponents()tocanEdit && !isIframeEmbed— correct for units and problem banks, which the MFE renders natively, but the MFE renders no add buttons for split_test (AddComponentonly renders its button list for unit verticals). Each group needs its own panel beside its own children, which only the container page can place.This restores
isSplitTestContentPageto the guard, as it was before3c5cc6fffd. Deliberately narrower than reverting to!model.isVertical(), so problem banks stay on MFE-native rendering.The rest of the flow was already iframe-aware and dead since the regression:
createComponent()postsaddNewComponent/hideProcessingNotificationto the parent for split_test,add_xblock.jskeeps template menus in the iframe when the parent is split_test, and frontend-app-authoring already handles both messages. Nothing changes server-side — the vertical author view always renders group children withcan_add=True, so the panels were in the fragment and only JS removed them. No frontend-app-authoring change is required.Supporting information
3c5cc6fffdTesting instructions
Requires the new unit page (
legacy_studio.unit_editordisabled — the default) and an asset rebuild, sincecontainer.jsis bundled into thejs/factories/containerwebpack entry:Set up an experiment, if the course has none:
"split_test"to Advanced Module List.Verify the fix:
/course/<course-id>/container/<split_test-id>/<subsection-id>.Verify nothing else changed:
/container/<split_test-id>→ unchanged (never took the regressed branch).Note on hard-refreshing: the iframe is a separate cross-origin document and dev builds emit an unhashed
container.js, so reload the frame itself or use "Disable cache" — a hard reload of the outer page can leave the old bundle in place.Automated tests: adds two specs to
container_spec.jscovering both branches. They have not been executed —karma_cms_webpack.conf.jsfails to start (ENOENT ... main_webpack.<hash>.js, #35956) andnpm run test-karmaskips that suite for the same reason. Verification was manual in Chrome, both directions: regressed bundle → 0 panels / 0 buttons; fixed → 2 panels / 16 buttons; adding a component writes it under the clicked group in the modulestore.Deadline
None
Other information
No dependent PRs, no MFE change, no migrations, no new settings. Limitation: this keeps the legacy per-group add widgets alive for content experiments; removing the legacy unit editor (#35261) will need per-group add UI rendered natively by the MFE.