From 47f6e821adee77810b7d65ea0b876f18c2917410 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 20 Apr 2020 09:35:35 -0700 Subject: [PATCH] Fixed: Import series failing to add items to process Closes #1380 (cherry picked from commit 97ec1847541ba2a73d25eedbd3c97aa6f2f7e4e0) --- frontend/src/Store/Actions/Creators/createHandleActions.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/Store/Actions/Creators/createHandleActions.js b/frontend/src/Store/Actions/Creators/createHandleActions.js index dc7b9cbd6..36a103da1 100644 --- a/frontend/src/Store/Actions/Creators/createHandleActions.js +++ b/frontend/src/Store/Actions/Creators/createHandleActions.js @@ -72,8 +72,9 @@ export default function createHandleActions(handlers, defaultState, section) { if (section === baseSection) { const newState = getSectionState(state, payloadSection); const items = newState.items; + const itemMap = newState.itemMap ?? {}; - const index = payload.id in newState.itemMap ? newState.itemMap[payload.id] : -1; + const index = payload.id in itemMap ? itemMap[payload.id] : -1; newState.items = [...items]; @@ -92,7 +93,7 @@ export default function createHandleActions(handlers, defaultState, section) { } else if (!updateOnly) { const newIndex = newState.items.push({ ...otherProps }) - 1; - newState.itemMap = { ...newState.itemMap }; + newState.itemMap = { ...itemMap }; newState.itemMap[payload.id] = newIndex; }