Problem/Motivation

The code used to generate the cid is:

$cid = 'css:' . $theme_info->getName() . ':' . Crypt::hashBase64(serialize($assets)) . (int) $optimize;

This means anything in $assets is part of the cache ID. As this includes drupalSettings this can include all sorts of things. Core's AssetResolver does:

    // Add the theme name to the cache key since themes may implement
    // hook_library_info_alter().
    $libraries_to_load = $this->getLibrariesToLoad($assets);
    $cid = 'css:' . $theme_info->getName() . ':' . Crypt::hashBase64(serialize($libraries_to_load)) . (int) $optimize;

Proposed resolution

Make it cache by library not the entire asset array.

Remaining tasks

Tests?

User interface changes

None

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

alexpott’s picture

alexpott’s picture

Here's a patch the brings core's logic into the advagg version.

NickDickinsonWilde’s picture

Thanks for the patches :D
Again, I'll commit now without test for time sake (woohoo more debt).

  • NickWilde committed 03ac1c7 on 8.x-2.x authored by alexpott
    Issue #2782591 by alexpott: \Drupal\advagg\Asset\AssetResolver::...
NickDickinsonWilde’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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