🥅 Error catching for when sections contain only widgets instead of items

This commit is contained in:
Alicia Sykes 2021-12-22 21:06:10 +00:00
parent 5194ba2244
commit c1d10d2791
2 changed files with 6 additions and 2 deletions

View File

@ -77,7 +77,7 @@ export default {
currentSection() {
let sectionName = '';
this.sections.forEach((section) => {
section.items.forEach((item) => {
(section.items || []).forEach((item) => {
if (item.id === this.itemId) sectionName = section.name;
});
});

View File

@ -41,7 +41,11 @@ export const applyItemId = (inputSections) => {
if (sec.items) {
sec.items.forEach((item, itemIdx) => {
sections[secIdx].items[itemIdx].id = makeItemId(sec.name, item.title, itemIdx);
// TODO: Check if ID already exists, and if so, modify it
});
}
if (sec.widgets) {
sec.widgets.forEach((widget, widgetIdx) => {
sections[secIdx].widgets[widgetIdx].id = makeItemId(sec.name, widget.type, widgetIdx);
});
}
});