Details
-
Bug
-
Resolution: Unresolved
-
Neutral
-
None
-
1.3.0
-
None
-
None
-
@magnolia/react-editor@1.3.0
Description
Steps to reproduce
- Try to create component, that uses EditableArea (like Slider > Slide, or List > ListItem)
- Create environment, where you will use component in isolation (Storybook, Jest, etc)
- Try to provide story with composition of parent-child component
- In order to do that you need to provide EditablePage in decorators, because EditablePage creates context, that area will use (EditableArea.js@getParentTemplateId)
<EditablePage content={{}} config={config} templateAnnotations={null}>
<Story />
</EditablePage>
- Try to run storybook/jest/etc
Expected results
Component renders without errors
Actual results
Component renders, but with type error in browser dev tools
mgnl-react-editor throws:
Warning: Failed prop type: Invalid prop `children` of type `object` supplied to `EditablePage`, expected a single ReactElement type.
Workaround
Development notes
I suppose that EditablePage was designed to use as self-closed tag, and doesn't receive children without errors, because of the PropTypes.elementType validator
Checklists
Acceptance criteria