修复某些情况下列表同步不一致的问题

pull/623/head
lyswhut 2021-08-19 15:23:29 +08:00
parent 4b5a7b6a74
commit 57a8b7842e
1 changed files with 12 additions and 7 deletions

View File

@ -96,16 +96,15 @@ const mutations = {
allListInit(state.defaultList, state.loveList, state.userList)
},
setList(state, { id, list, name, location, source, sourceListId, isSync }) {
if (!isSync) {
window.eventHub.$emit(eventSyncName.send_action_list, {
action: 'set_list',
data: { id, list, name, location, source, sourceListId },
})
}
const targetList = allList[id]
if (targetList) {
if (name && targetList.name === name) {
if (!isSync) {
window.eventHub.$emit(eventSyncName.send_action_list, {
action: 'set_list',
data: { id, list, name, location, source, sourceListId },
})
}
targetList.list.splice(0, targetList.list.length, ...list)
targetList.location = location
return
@ -113,6 +112,12 @@ const mutations = {
id += '_' + Math.random()
}
if (!isSync) {
window.eventHub.$emit(eventSyncName.send_action_list, {
action: 'set_list',
data: { id, list, name, location, source, sourceListId },
})
}
let newList = {
name,
id,