Filters to prune only custom categories (#6040)
This commit is contained in:
parent
5552c3a252
commit
2220a0d50c
1 changed files with 8 additions and 6 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue