Issue
- When deploying a Theme Contributor, it loads multiple times. The number of times varies depending on the website, page, and other factors.
Environment
- Liferay DXP 7.0 and later
Resolution
- Multiple calls to a Theme Contributor within a single page load is expected behavior. This is due to the lifecycle of widgets. Each widget executes the
prepare()method, which can trigger the Theme Contributor multiple times.- Component Loading: When a page loads, various components, including widgets in the header, footer, and page body, are loaded independently.
-
Embedded Widgets and Portlets: The presence of embedded widgets and portlets within a page necessitates multiple calls to the Theme Contributor, as each embedded widget or portlet triggers the execution of
prepare().
- There's no standard configuration or mechanism within Liferay DXP to limit the number of times a Theme Contributor is called. It's inherently tied to the widget and portlet lifecycle.
Additional Information
NOTE: The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.