clear entire cache when updating styles with global sections

This commit is contained in:
tophf 2018-03-22 04:26:43 +03:00
parent 89d4bb1ed4
commit 36b0e8f4bb

View File

@ -554,8 +554,17 @@ function invalidateCache({added, updated, deletedId} = {}) {
if (updated) { if (updated) {
if (cached) { if (cached) {
const isSectionGlobal = section =>
!section.urls.length &&
!section.urlPrefixes.length &&
!section.domains.length &&
!section.regexps.length;
const hadOrHasGlobals = cached.sections.some(isSectionGlobal) ||
updated.sections.some(isSectionGlobal);
const reenabled = !cached.enabled && updated.enabled; const reenabled = !cached.enabled && updated.enabled;
const equal = !reenabled && styleSectionsEqual(updated, cached, {ignoreCode: true}); const equal = !hadOrHasGlobals &&
!reenabled &&
styleSectionsEqual(updated, cached, {ignoreCode: true});
Object.assign(cached, updated); Object.assign(cached, updated);
if (equal) { if (equal) {
updateFiltersCache(cached); updateFiltersCache(cached);