fix: 修复在某些情况下移动歌曲时可能导致保存的顺序不对的问题(#2842)
This commit is contained in:
@@ -10,4 +10,4 @@
|
|||||||
- 修复某些情况下开放 API 获取到的音量为 0 的问题 (#2790)
|
- 修复某些情况下开放 API 获取到的音量为 0 的问题 (#2790)
|
||||||
- 修复 mg 图片、歌词获取
|
- 修复 mg 图片、歌词获取
|
||||||
- 修复某些 tx 歌单打开失败的问题 (#1060, @ght-000)
|
- 修复某些 tx 歌单打开失败的问题 (#1060, @ght-000)
|
||||||
- 修复在某些情况下添加歌曲时可能导致保存的歌曲顺序不对的问题(#2842)
|
- 修复在某些情况下添加、移动歌曲时可能导致保存的歌曲顺序不对的问题(#2842)
|
||||||
|
|||||||
@@ -275,10 +275,14 @@ export const musicsMove = (fromId: string, toId: string, musicInfos: LX.Music.Mu
|
|||||||
arrUnshift(toList, musicInfos)
|
arrUnshift(toList, musicInfos)
|
||||||
break
|
break
|
||||||
case 'bottom':
|
case 'bottom':
|
||||||
default:
|
default:{
|
||||||
moveMusicInfo(fromId, ids, toDBMusicInfo(musicInfos, toId, toList.length))
|
// 如果是添加到最后,那么取最后一个歌曲的原始位置 + 1 作为新歌曲的原始位置,否则新歌曲的原始位置为 position
|
||||||
|
// 因为原始 pos 可能比 targetList.length 大,所以不能直接用 targetList.length 作为新歌曲的原始位置
|
||||||
|
const order = toList.length ? (getMusicInfoOrder(toId, toList.at(-1)!.id)?.order ?? toList.length) + 1 : 0
|
||||||
|
moveMusicInfo(fromId, ids, toDBMusicInfo(musicInfos, toId, order))
|
||||||
arrPush(toList, musicInfos)
|
arrPush(toList, musicInfos)
|
||||||
break
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
listSet = new Set<string>(ids)
|
listSet = new Set<string>(ids)
|
||||||
|
|||||||
Reference in New Issue
Block a user