Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-5239

Handling of autogeneratedComponents doesn't depend on order in template definitions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Neutral
    • 4.5.11, 5.0.4, 5.1
    • None
    • rendering
    • None

    Description

      Steps to reproduce:

      • Lets have this structure of autogeneratedComponents
        - autoGeneration
        -- conent
        --- first component
        --- second component
        --- third component
        
      • Then visit the page where autogenerated components are located and remove the first component.
      • Previously removed component is automatically created and is ordered as last.
      • Remove second component then the component is not automatically created again.

      Similarly when you add new component into autogenerated components in template definitions - then if you place this component on first place then this component is generated during first visit of page, but when you add this component on different place then the component is not automatically generated.

      The problematic code is info.magnolia.rendering.generator.CopyGenerator.createNode(Node, Map<String, Object>)

      if(parentNode != null && parentNode.hasNode(name)) {
          log.debug("path {} was already found in repository. No need to create it.", parentNode.getPath() + "/" + name);
           break;
      }
      

      it checks if the component node exists if yes then it "break" for loop so no other components are processed.

      If we change break to continue then all component will be process, but this break the functionality of remove component from the page. Different question is if we want allow removing autogenerated components?

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                mdivilek Milan Divilek
                mdivilek Milan Divilek
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD