Replace lists by sets in the apply action cache

This commit is contained in:
Jonas Lochmann
2020-09-28 02:00:00 +02:00
parent 8d65c5d777
commit 8ebeadad5a
24 changed files with 55 additions and 46 deletions
@@ -177,7 +177,7 @@ export async function dispatchAddCategoryApps ({ action, cache, fromChildSelfLim
}
)
oldCategories.forEach((categoryId) => cache.categoriesWithModifiedApps.push(categoryId))
cache.categoriesWithModifiedApps.push(action.categoryId)
oldCategories.forEach((categoryId) => cache.categoriesWithModifiedApps.add(categoryId))
cache.categoriesWithModifiedApps.add(action.categoryId)
cache.areChangesImportant = true
}
@@ -74,6 +74,6 @@ export async function dispatchAddCategoryNetworkId ({ action, cache }: {
hashedNetworkId: action.hashedNetworkId
}, { transaction: cache.transaction })
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
@@ -57,6 +57,6 @@ export async function dispatchCreateTimeLimitRule ({ action, cache, fromChildSel
sessionPauseMilliseconds: action.rule.sessionPauseMilliseconds
}, { transaction: cache.transaction })
cache.categoriesWithModifiedTimeLimitRules.push(action.rule.categoryId)
cache.categoriesWithModifiedTimeLimitRules.add(action.rule.categoryId)
cache.areChangesImportant = true
}
@@ -37,6 +37,6 @@ export async function dispatchDeleteTimeLimitRule ({ action, cache }: {
await ruleEntry.destroy({ transaction: cache.transaction })
cache.categoriesWithModifiedTimeLimitRules.push(ruleEntry.categoryId)
cache.categoriesWithModifiedTimeLimitRules.add(ruleEntry.categoryId)
cache.areChangesImportant = true
}
@@ -40,7 +40,7 @@ export async function dispatchIncrementCategoryExtraTime ({ action, cache }: {
await category.save({ transaction: cache.transaction })
cache.categoriesWithModifiedBaseData.push(category.categoryId)
cache.categoriesWithModifiedBaseData.add(category.categoryId)
cache.areChangesImportant = true
}
@@ -41,6 +41,6 @@ export async function dispatchRemoveCategoryApps ({ action, cache }: {
})
}
cache.categoriesWithModifiedApps.push(action.categoryId)
cache.categoriesWithModifiedApps.add(action.categoryId)
cache.areChangesImportant = true
}
@@ -44,6 +44,6 @@ export async function dispatchResetCategoryNetworkIds ({ action, cache }: {
transaction: cache.transaction
})
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
@@ -51,6 +51,6 @@ export async function dispatchSetCategoryExtraTime ({ action, cache }: {
transaction: cache.transaction
})
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
@@ -117,6 +117,6 @@ export async function dispatchSetParentCategory ({ action, cache, fromChildSelfL
transaction: cache.transaction
})
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
@@ -45,6 +45,6 @@ export async function dispatchUpdateCategoryBatteryLimit ({ action, cache }: {
await categoryEntry.save({ transaction: cache.transaction })
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
@@ -59,7 +59,7 @@ export async function dispatchUpdateCategoryBlockAllNotifications ({ action, cac
})
if (affectedRows !== 0) {
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
}
@@ -69,6 +69,6 @@ export async function dispatchUpdateCategoryBlockedTimes ({ action, cache, fromC
transaction: cache.transaction
})
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
@@ -40,6 +40,6 @@ export async function dispatchUpdateCategorySorting ({ action, cache }: {
}
})
cache.categoriesWithModifiedBaseData.push(categoryId)
cache.categoriesWithModifiedBaseData.add(categoryId)
}
}
@@ -79,7 +79,7 @@ export async function dispatchUpdateCategoryTemporarilyBlocked ({ action, cache,
})
if (affectedRows !== 0) {
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
}
@@ -43,6 +43,6 @@ export async function dispatchUpdateCategoryTimeWarnings ({ action, cache }: {
await categoryEntry.save({ transaction: cache.transaction })
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
@@ -46,7 +46,7 @@ export async function dispatchUpdateCategoryTitle ({ action, cache }: {
})
if (affectedRows !== 0) {
cache.categoriesWithModifiedBaseData.push(action.categoryId)
cache.categoriesWithModifiedBaseData.add(action.categoryId)
cache.areChangesImportant = true
}
}
@@ -45,6 +45,6 @@ export async function dispatchUpdateTimelimitRule ({ action, cache }: {
await ruleEntry.save({ transaction: cache.transaction })
cache.categoriesWithModifiedTimeLimitRules.push(ruleEntry.categoryId)
cache.categoriesWithModifiedTimeLimitRules.add(ruleEntry.categoryId)
cache.areChangesImportant = true
}