Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Sling model Delegate in SPA project

Avatar

Level 2

A sling model delegate was added for page and XF components similar to as in the example given in this blog - https://levelup.gitconnected.com/aem-extend-core-component-models-using-resource-type-association-an...

 

Now while including an SPA Project to the same AEM instance, SPA Page model delegate in turn delegates to Page core component as in link. Though the resource type is different, earlier mentioned sling model delegate for page is always invoked by SPA Page model. Anyone faced such a scenario, pls guide.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @ramya726 ,

The resolution and the management of the page model is delegated to a provided PageModel library. The SPA must use the Page Model library to be initialized and be authored by the SPA Editor. The Page Model library provided indirectly to the AEM Page component via the aem-react-editable-component npm. The Page Model is an interpreter between AEM and the SPA and therefore always must be present. When the page is authored, an additional library cq.authoring.pagemodel.messaging must be added to enable the communication with the page editor.


For more details on it you can check below link
https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/spa...


Thanks
Tarun

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @ramya726 ,

The resolution and the management of the page model is delegated to a provided PageModel library. The SPA must use the Page Model library to be initialized and be authored by the SPA Editor. The Page Model library provided indirectly to the AEM Page component via the aem-react-editable-component npm. The Page Model is an interpreter between AEM and the SPA and therefore always must be present. When the page is authored, an additional library cq.authoring.pagemodel.messaging must be added to enable the communication with the page editor.


For more details on it you can check below link
https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/spa...


Thanks
Tarun

Avatar

Level 2

Thanks @TarunKumar . Have gone through the above suggestion, but still couldn't resolve the issue. Please find further details on the issue below,

 

(Non SPA project component)Existing Sling delegated Model resource type: wknd/components/experiencefragment

 

Now while including an SPA Project structure to the same AEM instance, We're facing an issue when we load a SPA page which contains experiencefragment component configured in template. 
SPA page invokes sling model where @Delegate annotation returns NULL which then results in model.json failure.

 

Ideally sling model should not be invoked while loading SPA page because the resourceType of experiencefragment component(wknd-spa-react/components/experiencefragment) used in SPA page is different from what we implemented in sling model.