Unable to initialize model manager api with remote spa app with newly created typescript react app | Community
Skip to main content
August 7, 2023
Solved

Unable to initialize model manager api with remote spa app with newly created typescript react app

  • August 7, 2023
  • 1 reply
  • 1210 views

Hi Team,

 

We are trying to convert remote spa javascript implementation to typescript(vite app latest version) but we are facing issue to initiliaze model manager with type script aem remote spa implementation please suggest if any other way to initialize model manager api in typescript.

 

We have created a react typescript app with latest vite version and trying to integrate aem configuration in react app. Attached error screenshot.

 

Regards,

Lakshman.

 

 

Regards,

lakshman.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

Hi,

 

Can you post your code? The only important part is that you should initiate the ModelManager before the root.render() invocation, or any other render() method which bootstrap the application. Like this:

... import { ModelManager } from "@adobe/aem-spa-page-model-manager"; // Initialize the ModelManager before invoking root.render(..). ModelManager.initializeAsync(); const container = document.getElementById('root'); const root = createRoot(container); root.render(<App />);

Reference: https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-with-aem-headless/spa-editor/remote-spa/spa-bootstrap.html?lang=en#integrate-the-modelmanager-api  

1 reply

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
August 23, 2023

Hi,

 

Can you post your code? The only important part is that you should initiate the ModelManager before the root.render() invocation, or any other render() method which bootstrap the application. Like this:

... import { ModelManager } from "@adobe/aem-spa-page-model-manager"; // Initialize the ModelManager before invoking root.render(..). ModelManager.initializeAsync(); const container = document.getElementById('root'); const root = createRoot(container); root.render(<App />);

Reference: https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-with-aem-headless/spa-editor/remote-spa/spa-bootstrap.html?lang=en#integrate-the-modelmanager-api  

Esteban Bustamante