JavaScriptComponent::getComponentUrl gets calculated twice on render for each component

Created on 6 August 2025, 2 days ago

Overview

\Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\JsComponent::renderComponent calls getComponentUrl to pass along in the build for the astro island. But the same URL is also created again in \Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\JsComponent::getScopedDependencies for the same component, even if it has no dependencies.

First

Then again

JsComponent::getScopedDependencies is meant to be recursive for imported components. If multiple components had the same dependency we could be recalculated the URL more times than needed.

Proposed resolution

Maybe \Drupal\experience_builder\Entity\JavaScriptComponent::getComponentUrl can statically cache the value once retrieved.

User interface changes

πŸ“Œ Task
Status

Active

Version

1.0

Component

… to be triaged

Created by

πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024