[PAGES-1552] Inheritance does not work for component that is inherited. Created: 12/Dec/23  Updated: 13/Dec/23  Resolved: 13/Dec/23

Status: Closed
Project: Magnolia pages module
Component/s: SPA Renderer
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Riste Drangovski Assignee: Oanh Thai Hoang
Resolution: Cannot Reproduce Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 2.5h Time Spent: 2.5h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: File Footer.yaml     File Page.yaml     PNG File Screenshot 2023-12-13 at 09.51.41.png     PNG File Screenshot 2023-12-13 at 09.55.33.png     PNG File child_page.png     PNG File compare.png     PNG File image-2023-12-13-10-08-32-228.png     PNG File image-2023-12-13-10-09-15-472.png     Zip Archive inherit-lm-reproduce.zip     PNG File list1-area.png     PNG File list2-area.png     PNG File parent_page.png     File test-1.0-SNAPSHOT.jar     File website.Page.yaml    
Sub-Tasks:
Key
Summary
Type
Status
Assignee
PAGES-1553 Implementation Sub-task To Do  
PAGES-1554 Review Sub-task To Do  
PAGES-1555 Pre-Integration QA Sub-task To Do  
PAGES-1556 QA Sub-task To Do  
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
Date of First Response:

 Description   

In case there is area in page template that has inheritance enabled and in this area you can add component that has area with also enabled inheritance, components from second area are not inherited in the json (delivery endpoint) response.

You can find in the attachments page and component template definitions for the above example.



 Comments   
Comment by Oanh Thai Hoang [ 13/Dec/23 ]

Hello rdrangovski . Thank for your feed back again

 

I'm in process of discovery this ticket and tried to reproduce your use case. The thing I want to check is your predicateClass: com.basf.wxp.rendering.filter.CustomFilteredInheritancePredicate.

 

1. Would you mind share with us above class to help us reproduce easier because I can't reproduce for now.

 

2. Or you can take a look below steps that how I try to reproduce:

You can download my light dev that I tried to set up like your use case inherit-lm-reproduce.zip

Page template: 

 

title: BASF Page
renderType: freemarker
templateScript: /inherit-lm-reproduce/templates/pages/Page.ftl
visible: true
dialog: inherit-lm-reproduce:components/basic
areas:
  footer:
    name: 'Footer Area'
    title: 'Footer Area'
    type: single
    inheritance:
      enabled: true
      components: all
      predicateClass: test.CustomFilteredInheritancePredicate
    availableComponents:
      Footer:
        id: inherit-lm-reproduce:components/Footer
 

 

A footer component:

 

title: Footer
templateScript: /inherit-lm-reproduce/templates/components/Footer.ftl
renderType: freemarker
dialog: inherit-lm-reproduce:components/basic

areas:
  socialBarArea:
    type: single
    inheritance:
      enabled: true
      components: all
      predicateClass: test.CustomFilteredInheritancePredicate
    availableComponents:
      SocialBar:
        id: inherit-lm-reproduce:components/SocialBar
  list1:
    type: single
    inheritance:
      enabled: true
      components: all
      predicateClass: test.CustomFilteredInheritancePredicate
    availableComponents:
      LinkList:
        id: inherit-lm-reproduce:components/Linklist
  list2:
    type: single
    inheritance:
      enabled: true
      components: all
      predicateClass: test.CustomFilteredInheritancePredicate
    availableComponents:
      LinkList:
        id: inherit-lm-reproduce:components/Linklist 

 

LinkList component contains jcrMultiField type

 

label: Linklist
form:
  properties:
    Linklist:
      $type: jcrMultiField
      label: Linklist
      field:
        $type: compositeField
        label: Link
        properties:
          link:
            $type: textField
            label: ""
    inherit:
      name: inheritable
      $type: checkBoxField
      label: Inherit
      buttonLabel: Inherited by Subpages
      defaultValue: true 

 

 

 

Regarding test.CustomFilteredInheritancePredicate. You can find my public sample here

This is very simple Filter class to evaluate node type and check property inheritable is true.

 

/**
 * A test.CustomFilteredInheritancePredicate file.
 */
public class CustomFilteredInheritancePredicate extends FilteredInheritancePredicate {    private static final String INHERITED_PROPERTY_NAME = "inheritable";    public CustomFilteredInheritancePredicate() {
        super();
        setNodeTypes(Lists.newArrayList(NodeTypes.Component.NAME, NodeTypes.ContentNode.NAME));
    }    @Override
    public boolean evaluateTyped(Node node) {
        try {
            return super.evaluateTyped(node) && (node.hasProperty(INHERITED_PROPERTY_NAME) && Boolean.parseBoolean(node.getProperty(INHERITED_PROPERTY_NAME).getString()));
        } catch (RepositoryException e) {
            throw new RuntimeRepositoryException(e);
        }
    }
} 

I also put a jar file here for custom filter class: test-1.0-SNAPSHOT.jar

 

Here is file to import to website to render that page: website.Page.yaml

How parent look like: 

How child look like: 

And you can execute rest via : *http://localhost:8080/magnoliaAuthor/.rest/delivery/pages/v3/Page/Child* 

 

From what I observe, all components are inherited correctly. Linklist component from list1 or list2 areas inside Footer component are included in json response

 

 

 

I'm looking for your response. 

 

Thank you so much

 

 

Comment by Riste Drangovski [ 13/Dec/23 ]

Hi,

I don't believe that it's predicate class, because even when I remove it, I still get same response in which I'm missing inherited components.
Pls, check screenshots:

 

I'll try your example and get back to you!

Thx for your effort!

Comment by Riste Drangovski [ 13/Dec/23 ]

I found the problem, we were overriding old version of delivery endpoint, issue is on our side, you can close this ticket.
Thank again for the effort !

Comment by Oanh Thai Hoang [ 13/Dec/23 ]

Hi rdrangovski . Thank you for your quick response. I close ticket now

Generated at Mon Feb 12 06:29:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.