diff --git a/src/main/worker/dbService/modules/download/index.ts b/src/main/worker/dbService/modules/download/index.ts index 81417fe5..4a93de40 100644 --- a/src/main/worker/dbService/modules/download/index.ts +++ b/src/main/worker/dbService/modules/download/index.ts @@ -104,12 +104,8 @@ export const downloadInfoUpdate = (lists: LX.Download.ListItem[]) => { export const downloadInfoRemove = (ids: string[]) => { deleteDownloadList(ids) if (list) { - const listSet = new Set() - for (const item of list) listSet.add(item.id) - for (const id of ids) listSet.delete(id) - const newList = list.filter(task => listSet.has(task.id)) - list.splice(0, list.length) - for (const item of newList) list.push(item) + const idSet = new Set(ids) + list = list.filter(task => !idSet.has(task.id)) } } diff --git a/src/main/worker/dbService/modules/list/index.ts b/src/main/worker/dbService/modules/list/index.ts index 7aab20ef..ccaefa6c 100644 --- a/src/main/worker/dbService/modules/list/index.ts +++ b/src/main/worker/dbService/modules/list/index.ts @@ -226,12 +226,8 @@ export const musicsRemove = (listId: string, ids: string[]) => { let targetList = getListMusics(listId) if (!targetList.length) return removeMusicInfos(listId, ids) - const listSet = new Set() - for (const item of targetList) listSet.add(item.id) - for (const id of ids) listSet.delete(id) - const newList = targetList.filter(mInfo => listSet.has(mInfo.id)) - targetList.splice(0, targetList.length) - arrPush(targetList, newList) + const idsSet = new Set(ids) + musicLists.set(listId, targetList.filter(mInfo => !idsSet.has(mInfo.id))) } /** @@ -267,12 +263,8 @@ export const musicsMove = (fromId: string, toId: string, musicInfos: LX.Music.Mu break } - listSet = new Set() - for (const item of fromList) listSet.add(item.id) - for (const id of ids) listSet.delete(id) - const newList = fromList.filter(mInfo => listSet.has(mInfo.id)) - fromList.splice(0, fromList.length) - arrPush(fromList, newList) + listSet = new Set(ids) + musicLists.set(fromId, fromList.filter(mInfo => !listSet.has(mInfo.id))) } /** diff --git a/src/renderer/components/base/VirtualizedList.vue b/src/renderer/components/base/VirtualizedList.vue index d151f6d1..7d72de4c 100644 --- a/src/renderer/components/base/VirtualizedList.vue +++ b/src/renderer/components/base/VirtualizedList.vue @@ -279,8 +279,6 @@ export default { }) watch(() => props.list, (list) => { handleReset(list) - }, { - deep: true, }) onMounted(() => { diff --git a/src/renderer/store/download/action.ts b/src/renderer/store/download/action.ts index b312e33e..663190c0 100644 --- a/src/renderer/store/download/action.ts +++ b/src/renderer/store/download/action.ts @@ -368,15 +368,13 @@ export const pauseDownloadTasks = async(list: LX.Download.ListItem[]) => { export const removeDownloadTasks = async(ids: string[]) => { await downloadTasksRemove(ids) - const listSet = new Set() - for (const item of downloadList) listSet.add(item.id) - for (const id of ids) listSet.delete(id) + const idsSet = new Set(ids) const newList = downloadList.filter(task => { if (runingTask.has(task.id)) { void window.lx.worker.download.removeTask(task.id) runingTask.delete(task.id) } - return listSet.has(task.id) + return !idsSet.has(task.id) }) downloadList.splice(0, downloadList.length) arrPush(downloadList, newList) diff --git a/src/renderer/store/list/listManage/action.ts b/src/renderer/store/list/listManage/action.ts index 39fcae91..e8afa1c7 100644 --- a/src/renderer/store/list/listManage/action.ts +++ b/src/renderer/store/list/listManage/action.ts @@ -1,4 +1,4 @@ -import { shallowReactive, markRaw, markRawList, toRaw } from '@common/utils/vueTools' +import { markRaw, markRawList, toRaw } from '@common/utils/vueTools' import { allMusicList, defaultList, @@ -16,7 +16,7 @@ export const setUserLists = (lists: LX.List.UserListInfo[]) => { } export const setMusicList = (listId: string, musicList: LX.Music.MusicInfo[]) => { - const list = shallowReactive(markRawList(musicList)) + const list = markRawList(musicList) allMusicList.set(listId, list) return list } @@ -29,7 +29,7 @@ const overwriteMusicList = (id: string, list: LX.Music.MusicInfo[]) => { targetList.splice(0, targetList.length) arrPush(targetList, list) } else { - allMusicList.set(id, shallowReactive(list)) + allMusicList.set(id, list) } } const removeMusicList = (id: string) => { @@ -258,10 +258,8 @@ export const listMusicRemove = (listId: string, ids: string[]): string[] => { let targetList = allMusicList.get(listId) if (!targetList) return listId == loveList.id ? [listId] : [] - const listSet = new Set() - for (const item of targetList) listSet.add(item.id) - for (const id of ids) listSet.delete(id) - const newList = targetList.filter(mInfo => listSet.has(mInfo.id)) + const idsSet = new Set(ids) + const newList = targetList.filter(mInfo => !idsSet.has(mInfo.id)) targetList.splice(0, targetList.length) arrPush(targetList, newList)