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

templateAnnotations/templateDefinitions empty check issue

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 1.1.0
    • None
    • None

    Description

      In EditablePage in React templateAnnotations/templateDefinitions can not be null/undefined.

      In area addComment is always run
      https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/browse/packages/react-editor/src/component/EditableArea/EditableArea.js#37

      and openComment is always assigned:
      https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/browse/packages/react-editor/src/component/EditableArea/EditableArea.js#62

      Meaning this code is run: templateAnnotations[content['@path']

      So to make it work we pass templateAnnotations as empty object.

      Problem is that in many places in code we can find things like
      if (templateAnnotations)
      eg: https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/browse/packages/react-editor/src/component/EditablePage/EditablePage.js#58

      And in JS if ({}) is true hence this check is not working as it should.

      Lets allow passing templateAnnotations/templateDefinitions as null/undefined so all the if against it work

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                rsiska Robert Šiška
                bstaryga Bartosz Staryga
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD

                    Time Tracking

                      Estimated:
                      Original Estimate - Not Specified
                      Not Specified
                      Remaining:
                      Remaining Estimate - Not Specified
                      Not Specified
                      Logged:
                      Time Spent - 0.5d
                      0.5d