Problem/Motivation

If the default color scheme is selected, then during submit color_scheme_form_submit() will return early and never fire Cache::invalidateTags(['library_info']);, so if any other scheme has previously been saved Drupal will keep trying to load it's now unlinked files.

Steps to reproduce:

  1. In Bartik settings select a color scheme, e.g. Plum, save the settings.
  2. Reload the front page to confirm the change etc.
  3. Next reselect the Default color scheme and save again - this will fail.

Proposed resolution

Perhaps adding Cache::invalidateTags(['library_info']); one line before the return? E.g.:

  // No change in color config, use the standard theme from color.inc.
  if (implode(',', color_get_palette($theme, TRUE)) == implode(',', $palette)) {
    $config->delete();
    Cache::invalidateTags(['library_info']); // add this here
    return;
  }

Remaining tasks

Review Patch

User interface changes

None.

API changes

None.

Comments

chintan.vyas’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new557 bytes

Clear the library cache works as mentioned.

catch’s picture

Priority: Critical » Major
Issue tags: +Needs tests

This looks major to me:

1. A cache clear will recover it

2. Color module is very optional

Visually very bad bug though if you run into it.

Could use test coverage.

netsensei’s picture

Status: Needs review » Needs work
netsensei’s picture

Status: Needs work » Needs review
StatusFileSize
new2.89 KB

I've added a failing test which mimics the steps described in the issue summary.
The proposed fix is included, but it fails too.

The odd thing is that $this->config('color.theme.bartik')->get('stylesheets'); yields NULL in the tests when the default (Blue Lagoon) color set is selected while the aggregated CSS does work correctly.

Status: Needs review » Needs work

The last submitted patch, 4: issue-2415663-3.patch, failed testing.

joelpittet’s picture

Status: Needs work » Closed (duplicate)

There is a working solution with tests that covers config import changes as well.

#2619332: Color scheme config changes aren't reflected in cached pages

Sorry didn't see this issue before completing the other. Maybe if the tests can be fixed we can merge into the other. Either way please comment on the other issue, I hope to have you all credited for resolving this problem.