fix: 修复了当`listPosition`未初始化时错误的删除操作 (#2178)
* feat: 新增了 当`列表歌曲位置`未初始化时删除列表时的判断 * fix --------- Co-authored-by: lyswhut <lyswhut@qq.com>pull/2179/head
parent
d0090abd01
commit
9644163dc5
|
@ -166,8 +166,8 @@ export const userListsRemove = (ids: string[]) => {
|
||||||
const changedIds = []
|
const changedIds = []
|
||||||
for (const id of ids) {
|
for (const id of ids) {
|
||||||
removeUserList(id)
|
removeUserList(id)
|
||||||
removeListPosition(id)
|
void removeListPosition(id)
|
||||||
removeListUpdateInfo(id)
|
void removeListUpdateInfo(id)
|
||||||
if (!allMusicList.has(id)) continue
|
if (!allMusicList.has(id)) continue
|
||||||
removeMusicList(id)
|
removeMusicList(id)
|
||||||
changedIds.push(id)
|
changedIds.push(id)
|
||||||
|
|
|
@ -56,7 +56,9 @@ export const setListPosition = async(id: string, position?: number) => {
|
||||||
listPosition[id] = position ?? 0
|
listPosition[id] = position ?? 0
|
||||||
saveListPositionThrottle()
|
saveListPositionThrottle()
|
||||||
}
|
}
|
||||||
export const removeListPosition = (id: string) => {
|
export const removeListPosition = async(id: string) => {
|
||||||
|
await initPosition()
|
||||||
|
if (listPosition[id] == null) return
|
||||||
delete listPosition[id]
|
delete listPosition[id]
|
||||||
saveListPositionThrottle()
|
saveListPositionThrottle()
|
||||||
}
|
}
|
||||||
|
@ -124,7 +126,9 @@ export const setListUpdateTime = async(id: string, time: number) => {
|
||||||
// listUpdateInfo[id] = { updateTime, isAutoUpdate }
|
// listUpdateInfo[id] = { updateTime, isAutoUpdate }
|
||||||
// saveListUpdateInfo()
|
// saveListUpdateInfo()
|
||||||
// }
|
// }
|
||||||
export const removeListUpdateInfo = (id: string) => {
|
export const removeListUpdateInfo = async(id: string) => {
|
||||||
|
await initListUpdateInfo()
|
||||||
|
if (listUpdateInfo[id] == null) return
|
||||||
delete listUpdateInfo[id]
|
delete listUpdateInfo[id]
|
||||||
saveListUpdateInfo()
|
saveListUpdateInfo()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue