mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 06:22:10 +08:00
修复同一首歌的URL、歌词等同时需要换源时的处理问题
This commit is contained in:
parent
dcd95a976c
commit
5a97c81540
@ -1,3 +1,4 @@
|
||||
### 修复
|
||||
|
||||
- 修复kg源的歌单链接无法打开的问题
|
||||
- 修复同一首歌的URL、歌词等同时需要换源时的处理问题
|
||||
|
@ -292,8 +292,13 @@ export const removeUserList = ({ id, isSync }) => async(dispatch, getState) => {
|
||||
dispatch(playerAction.checkPlayList([id]))
|
||||
}
|
||||
|
||||
const getOtherSourcePromises = new Map()
|
||||
|
||||
export const getOtherSource = ({ musicInfo, id }) => (dispatch, getState) => {
|
||||
return (musicInfo.otherSource && musicInfo.otherSource.length ? Promise.resolve(musicInfo.otherSource) : findMusic(musicInfo)).then(otherSource => {
|
||||
if (musicInfo.otherSource?.length) return Promise.resolve(musicInfo.otherSource)
|
||||
let key = `${musicInfo.source}_${musicInfo.songmid}`
|
||||
if (getOtherSourcePromises.has(key)) return getOtherSourcePromises.get(key)
|
||||
const promise = findMusic(musicInfo).then(otherSource => {
|
||||
const targetList = global.allList[id]
|
||||
if (targetList) {
|
||||
const index = targetList.indexOf(musicInfo)
|
||||
@ -304,8 +309,11 @@ export const getOtherSource = ({ musicInfo, id }) => (dispatch, getState) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
if (getOtherSourcePromises.has(key)) getOtherSourcePromises.delete(key)
|
||||
return otherSource
|
||||
})
|
||||
getOtherSourcePromises.set(key, promise)
|
||||
return promise
|
||||
}
|
||||
|
||||
export const setUserListName = ({ id, name, isSync }) => async(dispatch, getState) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user