mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 18:03:50 +00:00
[web] Fix unstable sorting by using 'stable' dependency
This commit is contained in:
parent
6d8731e144
commit
90d06dcf6f
@ -37,7 +37,8 @@
|
|||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"redux-mock-store": "^1.3.0",
|
"redux-mock-store": "^1.3.0",
|
||||||
"redux-thunk": "^2.2.0",
|
"redux-thunk": "^2.2.0",
|
||||||
"shallowequal": "^1.0.2"
|
"shallowequal": "^1.0.2",
|
||||||
|
"stable": "^0.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.26.0",
|
"babel-core": "^6.26.0",
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import stable from 'stable'
|
||||||
|
|
||||||
export const SET_FILTER = 'LIST_SET_FILTER'
|
export const SET_FILTER = 'LIST_SET_FILTER'
|
||||||
export const SET_SORT = 'LIST_SET_SORT'
|
export const SET_SORT = 'LIST_SET_SORT'
|
||||||
export const ADD = 'LIST_ADD'
|
export const ADD = 'LIST_ADD'
|
||||||
@ -35,7 +37,7 @@ export default function reduce(state = defaultState, action) {
|
|||||||
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case SET_FILTER:
|
case SET_FILTER:
|
||||||
view = list.filter(action.filter).sort(action.sort)
|
view = stable(list.filter(action.filter), action.sort)
|
||||||
viewIndex = {}
|
viewIndex = {}
|
||||||
view.forEach((item, index) => {
|
view.forEach((item, index) => {
|
||||||
viewIndex[item.id] = index
|
viewIndex[item.id] = index
|
||||||
@ -43,7 +45,7 @@ export default function reduce(state = defaultState, action) {
|
|||||||
break
|
break
|
||||||
|
|
||||||
case SET_SORT:
|
case SET_SORT:
|
||||||
view = [...view].sort(action.sort)
|
view = stable([...view], action.sort)
|
||||||
viewIndex = {}
|
viewIndex = {}
|
||||||
view.forEach((item, index) => {
|
view.forEach((item, index) => {
|
||||||
viewIndex[item.id] = index
|
viewIndex[item.id] = index
|
||||||
|
@ -5449,6 +5449,10 @@ sshpk@^1.7.0:
|
|||||||
jsbn "~0.1.0"
|
jsbn "~0.1.0"
|
||||||
tweetnacl "~0.14.0"
|
tweetnacl "~0.14.0"
|
||||||
|
|
||||||
|
stable@^0.1.6:
|
||||||
|
version "0.1.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.6.tgz#910f5d2aed7b520c6e777499c1f32e139fdecb10"
|
||||||
|
|
||||||
statuses@1:
|
statuses@1:
|
||||||
version "1.3.1"
|
version "1.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e"
|
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e"
|
||||||
|
Loading…
Reference in New Issue
Block a user