修复某些情况下列表同步不一致的问题
parent
4b5a7b6a74
commit
57a8b7842e
|
@ -96,16 +96,15 @@ const mutations = {
|
||||||
allListInit(state.defaultList, state.loveList, state.userList)
|
allListInit(state.defaultList, state.loveList, state.userList)
|
||||||
},
|
},
|
||||||
setList(state, { id, list, name, location, source, sourceListId, isSync }) {
|
setList(state, { id, list, name, location, source, sourceListId, isSync }) {
|
||||||
|
const targetList = allList[id]
|
||||||
|
if (targetList) {
|
||||||
|
if (name && targetList.name === name) {
|
||||||
if (!isSync) {
|
if (!isSync) {
|
||||||
window.eventHub.$emit(eventSyncName.send_action_list, {
|
window.eventHub.$emit(eventSyncName.send_action_list, {
|
||||||
action: 'set_list',
|
action: 'set_list',
|
||||||
data: { id, list, name, location, source, sourceListId },
|
data: { id, list, name, location, source, sourceListId },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetList = allList[id]
|
|
||||||
if (targetList) {
|
|
||||||
if (name && targetList.name === name) {
|
|
||||||
targetList.list.splice(0, targetList.list.length, ...list)
|
targetList.list.splice(0, targetList.list.length, ...list)
|
||||||
targetList.location = location
|
targetList.location = location
|
||||||
return
|
return
|
||||||
|
@ -113,6 +112,12 @@ const mutations = {
|
||||||
|
|
||||||
id += '_' + Math.random()
|
id += '_' + Math.random()
|
||||||
}
|
}
|
||||||
|
if (!isSync) {
|
||||||
|
window.eventHub.$emit(eventSyncName.send_action_list, {
|
||||||
|
action: 'set_list',
|
||||||
|
data: { id, list, name, location, source, sourceListId },
|
||||||
|
})
|
||||||
|
}
|
||||||
let newList = {
|
let newList = {
|
||||||
name,
|
name,
|
||||||
id,
|
id,
|
||||||
|
|
Loading…
Reference in New Issue