Composer has performance issues

Prev Next

Symptoms

When editing a spot in the HTML Composer, performance slows down due to media preloading.

Resolution

The following explanation and steps can help you identify and solve the issue.

Understand media retrieval

In the spot, the getElementWrapper function from the gfWizardBase library is used to get media data from the ascData field.

This function calls another function called wrap. When it handles a media element, it creates a DOM element called clippedMediaHtml using the getMediaElements function. This causes all related images and videos to load.

Loading all this media can slow down performance.

Switch functions

To avoid performance issues, you can use the getElementValue function instead. It lets you access media data through getMediaData, without creating the wrapper.

This prevents the media from loading unnecessarily and helps improve performance.

const mediaElement = window.gfWizardBase.getElementValue('Media');
const mediaDataObject = window.gfWizardBase.getMediaData(mediaElement[0]?.SpotId);
const mediaUrl = mediaDataObject?.FullFilePath || null;

Note

To learn more, see our articles on HTML spot development.