Uploaded image for project: 'Magnolia Frontend Helpers'
  1. Magnolia Frontend Helpers
  2. MGNLFE-410

EditablePage children prop - react-editor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • 1.3.0
    • None
    • None
    • @magnolia/react-editor@1.3.0

    Description

      Steps to reproduce

      1. Try to create component, that uses EditableArea (like Slider > Slide, or List > ListItem)
      2. Create environment, where you will use component in isolation (Storybook, Jest, etc)
      3. Try to provide story with composition of parent-child component
      4. 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>
      1. 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

        Attachments

          Activity

            People

              Unassigned Unassigned
              NDQ Mykola
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD