aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorJason <jason.daurus@gmail.com>2016-06-23 23:48:17 +0800
committerJason <jason.daurus@gmail.com>2016-06-23 23:48:17 +0800
commit84683e7abb07fd2d3a9e79b74cb9a1e4013ad83b (patch)
tree1839b9136ee8c60f5cabafc717c3c930fe76fcdd /web
parentf50dc62249f8873d3704738c82580b9cf2369750 (diff)
downloadmitmproxy-84683e7abb07fd2d3a9e79b74cb9a1e4013ad83b.tar.gz
mitmproxy-84683e7abb07fd2d3a9e79b74cb9a1e4013ad83b.tar.bz2
mitmproxy-84683e7abb07fd2d3a9e79b74cb9a1e4013ad83b.zip
[web] check item existence before update
Diffstat (limited to 'web')
-rw-r--r--web/src/js/ducks/eventLog.js2
-rwxr-xr-xweb/src/js/ducks/utils/view.js8
2 files changed, 8 insertions, 2 deletions
diff --git a/web/src/js/ducks/eventLog.js b/web/src/js/ducks/eventLog.js
index aa472592..81f19e2e 100644
--- a/web/src/js/ducks/eventLog.js
+++ b/web/src/js/ducks/eventLog.js
@@ -120,7 +120,7 @@ export function fetchData() {
return fetchApi('/events')
.then(res => res.json())
- .then(json => dispatch(receive(json.data)))
+ .then(json => dispatch(receive(json.data)))
.catch(error => dispatch(fetchError(error)))
}
}
diff --git a/web/src/js/ducks/utils/view.js b/web/src/js/ducks/utils/view.js
index 20260537..87a05987 100755
--- a/web/src/js/ducks/utils/view.js
+++ b/web/src/js/ducks/utils/view.js
@@ -32,7 +32,7 @@ export default function reduce(state = defaultState, action) {
}
case ADD:
- if (!action.filter(action.item)) {
+ if (state.indexOf[action.item.id] != null || !action.filter(action.item)) {
return state
}
return {
@@ -41,12 +41,18 @@ export default function reduce(state = defaultState, action) {
}
case REMOVE:
+ if (state.indexOf[action.item.id] == null) {
+ return state
+ }
return {
...state,
...sortedRemove(state, action.id),
}
case UPDATE:
+ if (state.indexOf[action.item.id] == null) {
+ return
+ }
const nextState = {
...state,
...sortedRemove(state, action.id),