You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor or deprecate parent-child relationships between XBlocks #729
Remove parent-child relationships on the base XBlock class. Delete the _HasChildrenMetaclass. Move all parent-child logic to a new subclass, XBlockWithChildren. Make it XBlock.has_children a read-only class property. Some details.
Raise an exception if get_parent is called at or above the VerticalBlock level.
For all XBlockWithChildren subclasses above the VerticalBlock (so, CourseBlock, SectionBlock, and SequenceBlock): Move their implementations to either Learning Core or edx-platform djangoapps.
Decide: Should parent-child relationships still exist at/below the Vertical block?
Either way -> ADR it.
Yes -> We're done.
No -> File another DEPR encompassing our plan to:
Raise deprecation warnings on the XBlockWithChildren class.
For all remaining XBlockWithChildren subclasses in edx-platform (eg, LibraryContentBlock, SplitTestBlock):
Move their implementations to either Learning Core or edx-platform djangoapps.
Write guidance on how custom XBlockWithChildren subclasses can be similarly migrated. Ensure that, for example, OpenCraft's ProblemBuilder block can be migrated using this guide.
Delete the XBlockWithChildren class, and delete all parent-child logic from the XBlock repository.
Delete all parent-child logic from modulestore and edx-platform's XBlock runtimes.
Problem Builder makes extensive use of child blocks. If we deprecated has_children, we'd need to figure out a path forward for courses that use Problem Builder, but that's been known for a while so needn't be a blocker here, just something to solve at the same time.
For the other three (conditional, split, LCB), I think they're going to be a blocker for now until we have some kind of Outline concept that can unify and replace them. But what I'd love to do is put in a restriction so that only those three blocks can have children, and attempting to do it for other blocks will raise an error. That way we can prevent people from introducing new dependencies on has_children.
@kdmccormick@ormsbee Apparently there are three other XBlocks from eduNEXT which also rely on XBlock children, and currently only work in the legacy Studio UI:
https://github.com/eduNEXT/xblock-extemporaneous-grading - "allows the course author to set a due date and a late due date for a set of components. The learner will only be able to see the content of the components if they are within the established dates."
Now, these all seem like things that should be "selectors" / outline transformers / dynamic containers rather than XBlock components in our new world. So I'll mention these use cases on that other thread. But I bring it up here because I think we need to make a clear decision on what will happen to XBlocks that depend on children, i.e. DEPR that, and also we need to add something to the Authoring MFE UI to either temporarily support these use cases or state that they're unsupported, rather than the status quo of displaying a broken UI.
Activity
bradenmacdonald commentedon Mar 20, 2024
Other than the "structural" XBlocks (course, sequential, vertical/unit, etc.), the only blocks I know of with
has_childrenare:ConditionalBlock(built-in)SplitTestBlock(built-in, for A/B testing)LibraryContentBlock(built-in, may be renamed to Problem Bank or Item Pool Block)has_children, we'd need to figure out a path forward for courses that use Problem Builder, but that's been known for a while so needn't be a blocker here, just something to solve at the same time.For the other three (conditional, split, LCB), I think they're going to be a blocker for now until we have some kind of Outline concept that can unify and replace them. But what I'd love to do is put in a restriction so that only those three blocks can have children, and attempting to do it for other blocks will raise an error. That way we can prevent people from introducing new dependencies on has_children.
bradenmacdonald commentedon Sep 5, 2025
@kdmccormick @ormsbee Apparently there are three other XBlocks from eduNEXT which also rely on XBlock children, and currently only work in the legacy Studio UI:
Now, these all seem like things that should be "selectors" / outline transformers / dynamic containers rather than XBlock components in our new world. So I'll mention these use cases on that other thread. But I bring it up here because I think we need to make a clear decision on what will happen to XBlocks that depend on children, i.e. DEPR that, and also we need to add something to the Authoring MFE UI to either temporarily support these use cases or state that they're unsupported, rather than the status quo of displaying a broken UI.
Thoughts?