From f25aa07d5f91b27d57f6850a078c8c3200b81665 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 17 Jan 2022 19:52:15 +0000 Subject: [PATCH] :bug: Check items exist before itterating #415 --- src/store.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/store.js b/src/store.js index 5cb0be23..79848645 100644 --- a/src/store.js +++ b/src/store.js @@ -70,8 +70,10 @@ const store = new Vuex.Store({ getItemById: (state, getters) => (id) => { let item; getters.sections.forEach(sec => { - const foundItem = sec.items.find((itm) => itm.id === id); - if (foundItem) item = foundItem; + if (sec.items) { + const foundItem = sec.items.find((itm) => itm.id === id); + if (foundItem) item = foundItem; + } }); return item; },