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!

:zap: Adds type checking for section search

Alicia Sykesa5944c1d0682
diff --git a/src/components/Workspace/SideBar.vue b/src/components/Workspace/SideBar.vue
index 40ac0d02..2442403c 100644
--- a/src/components/Workspace/SideBar.vue
+++ b/src/components/Workspace/SideBar.vue
@@ -64,10 +64,10 @@ export default {
/* If an initial URL is specified, then open relevant section */
openDefaultSection() {
if (!this.initUrl) return;
- const process = (url) => url.replace(/[^\w\s]/gi, '').toLowerCase();
+ const process = (url) => (url ? url.replace(/[^\w\s]/gi, '').toLowerCase() : undefined);
const compare = (item) => (process(item.url) === process(this.initUrl));
- this.sections.forEach((section, sectionIndex) => {
- if (section.items.findIndex(compare) !== -1) this.openSection(sectionIndex);
+ this.sections.forEach((section, secIndex) => {
+ if (section.items && section.items.findIndex(compare) !== -1) this.openSection(secIndex);
});
},
},