adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
730 stars 736 forks source link

Core Navigation component - data layer not working as expected for second level child items #2354

Open sowmyapp opened 1 year ago

sowmyapp commented 1 year ago

Environment: AEM as a Cloud (SDK version-2022.9.8722.20220912T101352Z) Core Components version - 2.20.8 JRE version - Java(TM) SE Runtime Environment 18.9 (build 11.0.8+10-LTS)

Current Behavior: Analytics data layer for core navigation component (/libs/core/wcm/components/navigation/v2/navigation) is not working properly for second level navigation children pages. We are unable to see the parent id for second level navigation child pages. Please find screenshot attached.

Expected behavior/code: Second level navigation child items also should have the parentId value pointing to the first level.

Additional context / Screenshots image

ky940819 commented 1 year ago

If this is something that should be included in all list items then the solution would probably just be to add

.withParentId(() -> this.parentId)

to AbstractListItemImpl#getComponentData https://github.com/adobe/aem-core-wcm-components/blob/f13f3de9a3176ca2d4ff565464fa77194b4af101/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v1/AbstractListItemImpl.java#L82-L91