From d4b459facc3c8d9ce034e4faea0591d28279fa7c Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sun, 3 Apr 2022 16:23:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=97=A0=E6=95=88=E6=AD=8C?= =?UTF-8?q?=E6=9B=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 1 + src/store/modules/list/action.js | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index ddf58b0..6be1498 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -7,6 +7,7 @@ ### 修复 - 修复wy源搜索某些歌曲时第一页之后的歌曲无法加载的问题 +- 每次启动时过滤无效的歌曲 ### 变更 diff --git a/src/store/modules/list/action.js b/src/store/modules/list/action.js index c154a9f..aed130a 100644 --- a/src/store/modules/list/action.js +++ b/src/store/modules/list/action.js @@ -85,9 +85,13 @@ export const initList = listData => async(dispatch, getState) => { const allList = [...(userList ?? [])] if (loveList) allList.unshift(loveList) if (defaultList) allList.unshift(defaultList) + + // 临时 - 过滤无效歌曲 allList.forEach(list => { let isNeedSaveList = false const newList = list.list.filter(musicInfo => { + if (!musicInfo) return false + // PC v1.8.2以前的Lyric if (musicInfo.lxlrc) { delete musicInfo.lxlrc @@ -104,7 +108,11 @@ export const initList = listData => async(dispatch, getState) => { return !!musicInfo.songmid }) - if (isNeedSaveList || newList.length != list.length) needSaveLists.push(list) + if (newList.length != list.list.length) { + list.list = newList + isNeedSaveList = true + } + if (isNeedSaveList) needSaveLists.push(list) }) if (needSaveLists.length) saveList(needSaveLists)