Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:goal_net: Error catching for when sections contain only widgets instead of items

Alicia Sykesc1d10d2791b5
diff --git a/src/components/InteractiveEditor/MoveItemTo.vue b/src/components/InteractiveEditor/MoveItemTo.vue
index 7a604d30..990d7d37 100644
--- a/src/components/InteractiveEditor/MoveItemTo.vue
+++ b/src/components/InteractiveEditor/MoveItemTo.vue
@@ -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;
});
});
diff --git a/src/utils/MiscHelpers.js b/src/utils/MiscHelpers.js
index 6d941fe7..37d07849 100644
--- a/src/utils/MiscHelpers.js
+++ b/src/utils/MiscHelpers.js
@@ -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);
});
}
});