Filters to prune only custom categories (#6040)

This commit is contained in:
Shaz Amjad
2022-03-10 06:18:58 +11:00
committed by GitHub
parent 5552c3a252
commit 2220a0d50c

View File

@@ -58,12 +58,14 @@ export const storeCategories = async (serverUrl: string, categories: CategoryWit
const teamIds = pluckUnique('team_id')(categories) as string[];
const localCategories = await queryCategoriesByTeamIds(database, teamIds);
localCategories.forEach((localCategory) => {
if (!remoteCategoryIds.includes(localCategory.id)) {
localCategory.prepareDestroyPermanently();
flattenedModels.push(localCategory);
}
});
localCategories.
filter((category) => category.type === 'custom').
forEach((localCategory) => {
if (!remoteCategoryIds.includes(localCategory.id)) {
localCategory.prepareDestroyPermanently();
flattenedModels.push(localCategory);
}
});
}
if (prepareRecordsOnly) {