[MAGNOLIA-5239] Handling of autogeneratedComponents doesn't depend on order in template definitions Created: 15/Aug/13  Updated: 27/Aug/13  Resolved: 26/Aug/13

Status: Closed
Project: Magnolia
Component/s: rendering
Affects Version/s: None
Fix Version/s: 4.5.11, 5.0.4, 5.1

Type: Bug Priority: Neutral
Reporter: Milan Divilek Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File ComponentElement .patch    
Issue Links:
relation
is related to MAGNOLIA-5148 Auto generated components are not alw... Closed
is related to DOCU-464 Autogenerated components - Descriptio... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 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?


Generated at Mon Feb 12 04:03:17 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.