🐛 Check items exist before itterating #415
This commit is contained in:
@@ -70,8 +70,10 @@ const store = new Vuex.Store({
|
|||||||
getItemById: (state, getters) => (id) => {
|
getItemById: (state, getters) => (id) => {
|
||||||
let item;
|
let item;
|
||||||
getters.sections.forEach(sec => {
|
getters.sections.forEach(sec => {
|
||||||
const foundItem = sec.items.find((itm) => itm.id === id);
|
if (sec.items) {
|
||||||
if (foundItem) item = foundItem;
|
const foundItem = sec.items.find((itm) => itm.id === id);
|
||||||
|
if (foundItem) item = foundItem;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user