mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-29 20:11:53 +03:00
🥅 Error catching for when sections contain only widgets instead of items
This commit is contained in:
parent
5194ba2244
commit
c1d10d2791
@ -77,7 +77,7 @@ export default {
|
|||||||
currentSection() {
|
currentSection() {
|
||||||
let sectionName = '';
|
let sectionName = '';
|
||||||
this.sections.forEach((section) => {
|
this.sections.forEach((section) => {
|
||||||
section.items.forEach((item) => {
|
(section.items || []).forEach((item) => {
|
||||||
if (item.id === this.itemId) sectionName = section.name;
|
if (item.id === this.itemId) sectionName = section.name;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -41,7 +41,11 @@ export const applyItemId = (inputSections) => {
|
|||||||
if (sec.items) {
|
if (sec.items) {
|
||||||
sec.items.forEach((item, itemIdx) => {
|
sec.items.forEach((item, itemIdx) => {
|
||||||
sections[secIdx].items[itemIdx].id = makeItemId(sec.name, item.title, 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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user