aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/ducks/utils
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2018-02-05 08:21:27 +0100
committerGitHub <noreply@github.com>2018-02-05 08:21:27 +0100
commit05ae3460c018bc33999534ac2dbab8fa3a6c9c96 (patch)
treecb874f9da3baa32b14da7735938e54a7be2d29c4 /web/src/js/ducks/utils
parent91834f98ccb1e586dabb9c269c369a094a00f2f0 (diff)
parent90d06dcf6fde398a71b54ee863e4df862746eeb3 (diff)
downloadmitmproxy-05ae3460c018bc33999534ac2dbab8fa3a6c9c96.tar.gz
mitmproxy-05ae3460c018bc33999534ac2dbab8fa3a6c9c96.tar.bz2
mitmproxy-05ae3460c018bc33999534ac2dbab8fa3a6c9c96.zip
Merge pull request #2835 from MatthewShao/mitmweb-sort
[web] Fix unstable sorting
Diffstat (limited to 'web/src/js/ducks/utils')
-rw-r--r--web/src/js/ducks/utils/store.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/web/src/js/ducks/utils/store.js b/web/src/js/ducks/utils/store.js
index ac272650..ad2242ee 100644
--- a/web/src/js/ducks/utils/store.js
+++ b/web/src/js/ducks/utils/store.js
@@ -1,3 +1,5 @@
+import stable from 'stable'
+
export const SET_FILTER = 'LIST_SET_FILTER'
export const SET_SORT = 'LIST_SET_SORT'
export const ADD = 'LIST_ADD'
@@ -35,7 +37,7 @@ export default function reduce(state = defaultState, action) {
switch (action.type) {
case SET_FILTER:
- view = list.filter(action.filter).sort(action.sort)
+ view = stable(list.filter(action.filter), action.sort)
viewIndex = {}
view.forEach((item, index) => {
viewIndex[item.id] = index
@@ -43,7 +45,7 @@ export default function reduce(state = defaultState, action) {
break
case SET_SORT:
- view = [...view].sort(action.sort)
+ view = stable([...view], action.sort)
viewIndex = {}
view.forEach((item, index) => {
viewIndex[item.id] = index