From 38148a99552f0380ae81881672dd4f4943d58b5f Mon Sep 17 00:00:00 2001 From: ArthurMousatov Date: Wed, 23 Aug 2023 23:37:09 -0400 Subject: [PATCH] fix: added conditional to fix undefined attribute exception --- frontend/src/store/mutations.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/store/mutations.js b/frontend/src/store/mutations.js index 87493609..bc8cece7 100644 --- a/frontend/src/store/mutations.js +++ b/frontend/src/store/mutations.js @@ -78,9 +78,12 @@ const mutations = { } }, updateRequest: (state, value) => { - state.oldReq = state.req; const selectedItems = state.selected.map((i) => state.req.items[i]); + state.oldReq = state.req; state.req = value; + state.selected = []; + + if (!state.req?.items) return; state.selected = state.req.items .filter((item) => selectedItems.some((rItem) => rItem.url === item.url)) .map((item) => item.index);