diff options
author | Jason <jason.daurus@gmail.com> | 2016-06-24 01:01:34 +0800 |
---|---|---|
committer | Jason <jason.daurus@gmail.com> | 2016-06-24 01:01:34 +0800 |
commit | c40ff0277bc3a3668ffcfa7b1489998603d3c31c (patch) | |
tree | 7bca788e8ed4af6047afa5a7c7c08f55161e70b8 /web/src/js/ducks/utils/list.js | |
parent | e11d6600bea35eed9b60a95aca8f210f1cdb4dea (diff) | |
download | mitmproxy-c40ff0277bc3a3668ffcfa7b1489998603d3c31c.tar.gz mitmproxy-c40ff0277bc3a3668ffcfa7b1489998603d3c31c.tar.bz2 mitmproxy-c40ff0277bc3a3668ffcfa7b1489998603d3c31c.zip |
[web] fix bugs
Diffstat (limited to 'web/src/js/ducks/utils/list.js')
-rw-r--r-- | web/src/js/ducks/utils/list.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/web/src/js/ducks/utils/list.js b/web/src/js/ducks/utils/list.js index 9649dde3..e66a8549 100644 --- a/web/src/js/ducks/utils/list.js +++ b/web/src/js/ducks/utils/list.js @@ -11,22 +11,27 @@ const defaultState = { } export default function reduce(state = defaultState, action) { - if (state.pendingActions && action.type !== RECEIVE) { - return { - ...state, - pendingActions: [...state.pendingActions, action] - } - } - switch (action.type) { case SET: + if (state.pendingActions) { + return { + ...state, + pendingActions: [...state.pendingActions, action] + } + } return { ...state, data: { ...state.data, [action.id]: null, [action.item.id]: action.item } } case CLEAR: + if (state.pendingActions) { + return { + ...state, + pendingActions: [...state.pendingActions, action] + } + } return { ...state, data: { ...state.data, [action.id]: null } |