Problem/Motivation

\Drupal\geolocation\Element\GeolocationMap::getInfo has 3 callbacks, two as $class, one as $ths.

This causes it to store the current instance of the plugin object, including it's injected dependencies in the element info cache, which means it needs to load those classes and unserialize them on every request.

Steps to reproduce

Proposed resolution

use $class, do not use DI.

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

berdir created an issue. See original summary.

berdir’s picture

Status: Active » Needs review

It's actually a pattern used by 4 element plugins.

It's not a huge issue, but it should also have the positive side effect of solving some annoying issues with how we generate a preload file, as the order of how these classes are loaded is somehow not stable.

Note: I tested/noticed this on 3.x, and the classes in 4.x are quite different, but the pattern is the same.

berdir’s picture

Wasn't sure if I should mark this as bug or task, it's not a functional bug, just a performance "bug".

christianadamski made their first commit to this issue’s fork.

christianadamski’s picture

Status: Needs review » Fixed

Interesting, thanks!

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.

Status: Fixed » Closed (fixed)

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