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:
- In Bartik settings select a color scheme, e.g. Plum, save the settings.
- Reload the front page to confirm the change etc.
- 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
Comment #1
chintan.vyas commentedClear the library cache works as mentioned.
Comment #2
catchThis 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.
Comment #3
netsensei commentedComment #4
netsensei commentedI'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.Comment #6
joelpittetThere 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.