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 = []
|
||||
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)
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue