From 9644163dc5f8cde89f9075052f11a32f49083557 Mon Sep 17 00:00:00 2001 From: 14K <34759162+14Kay@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:32:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=BD=93`lis?= =?UTF-8?q?tPosition`=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E5=88=A0=E9=99=A4=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=20(#2178)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 新增了 当`列表歌曲位置`未初始化时删除列表时的判断 * fix --------- Co-authored-by: lyswhut --- src/renderer/store/list/listManage/action.ts | 4 ++-- src/renderer/utils/data.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/renderer/store/list/listManage/action.ts b/src/renderer/store/list/listManage/action.ts index 295836b4..6a84ddd8 100644 --- a/src/renderer/store/list/listManage/action.ts +++ b/src/renderer/store/list/listManage/action.ts @@ -166,8 +166,8 @@ export const userListsRemove = (ids: string[]) => { const changedIds = [] for (const id of ids) { removeUserList(id) - removeListPosition(id) - removeListUpdateInfo(id) + void removeListPosition(id) + void removeListUpdateInfo(id) if (!allMusicList.has(id)) continue removeMusicList(id) changedIds.push(id) diff --git a/src/renderer/utils/data.ts b/src/renderer/utils/data.ts index 3c041550..7911d42b 100644 --- a/src/renderer/utils/data.ts +++ b/src/renderer/utils/data.ts @@ -56,7 +56,9 @@ export const setListPosition = async(id: string, position?: number) => { listPosition[id] = position ?? 0 saveListPositionThrottle() } -export const removeListPosition = (id: string) => { +export const removeListPosition = async(id: string) => { + await initPosition() + if (listPosition[id] == null) return delete listPosition[id] saveListPositionThrottle() } @@ -124,7 +126,9 @@ export const setListUpdateTime = async(id: string, time: number) => { // listUpdateInfo[id] = { updateTime, isAutoUpdate } // saveListUpdateInfo() // } -export const removeListUpdateInfo = (id: string) => { +export const removeListUpdateInfo = async(id: string) => { + await initListUpdateInfo() + if (listUpdateInfo[id] == null) return delete listUpdateInfo[id] saveListUpdateInfo() }