diff options
Diffstat (limited to 'web/src/js/ducks/utils/list.js')
-rw-r--r-- | web/src/js/ducks/utils/list.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/web/src/js/ducks/utils/list.js b/web/src/js/ducks/utils/list.js index a5ce7250..a830fe99 100644 --- a/web/src/js/ducks/utils/list.js +++ b/web/src/js/ducks/utils/list.js @@ -62,8 +62,9 @@ export default function makeList(actionType, fetchURL) { itemIndex = state.indexOf[action.item.id] list[itemIndex] = action.item return { - ...defaultState, - list + ...state, + list, + byId: {...state.byId, [action.item.id]: action.item}, } case REMOVE: @@ -71,7 +72,7 @@ export default function makeList(actionType, fetchURL) { itemIndex = state.indexOf[action.item.id] list.splice(itemIndex, 1) return { - ...defaultState, + ...state, list, byId: {...state.byId, [action.item.id]: undefined}, indexOf: {...state.indexOf, [action.item.id]: undefined}, @@ -79,7 +80,7 @@ export default function makeList(actionType, fetchURL) { case REQUEST_LIST: return { - ...defaultState, + ...state, isFetching: true } |