🐛 Fix wrong position of wrapper when migrating from old schema

This commit is contained in:
Manuel Ruwe
2023-01-11 21:28:24 +01:00
parent e41f63345c
commit ff0f96b4b6
2 changed files with 15 additions and 2 deletions

View File

@@ -131,10 +131,19 @@ const getConfigAndCreateIfNotExsists = (
const category: CategoryType = {
id: uuidv4(),
name: categoryName,
position: config.categories.length,
position: config.categories.length + 1, // sync up with index of categories
};
config.categories.push(category);
// sync up with categories
if (config.wrappers.length < config.categories.length) {
config.wrappers.push({
id: uuidv4(),
position: config.wrappers.length + 1, // sync up with index of categories
});
}
return category;
};