Problem/Motivation

DisplayBuilderEventsSubscriber::dispatchToIslands() creates instances before filtering to keep enabled instances only.

    $islands = $this->islandManager->createInstances($this->islandManager->getDefinitions(), $contexts, $configuration);

    $island_enabled = $event->getEnabledIslands();
    $visible_islands = $event->getVisibleIslands();

    foreach ($islands as $island_id => $island) {
      if (!isset($island_enabled[$island_id])) {
        continue;
      }

Proposed resolution

Filter the definitions before instantiating:

$definitions = \array_intersect_key($this->islandManager->getDefinitions(), $island_enabled);
$islands = $this->islandManager->createInstances($definitions, $contexts, $configuration);

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mogtofu33 created an issue. See original summary.

mogtofu33’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • mogtofu33 committed 1d27377a on 1.0.x
    fix: #3616239 optimize island instance creation by filtering enabled...
pdureau’s picture

Thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.