修复同一首歌的URL、歌词等同时需要换源时的处理问题
parent
254b82cc60
commit
09f4d8ac0c
|
@ -9,3 +9,4 @@
|
|||
### 修复
|
||||
|
||||
- 修复kg源的歌单链接无法打开的问题
|
||||
- 修复同一首歌的URL、歌词等同时需要换源时的处理问题
|
||||
|
|
|
@ -53,13 +53,21 @@ const getters = {
|
|||
allList: () => allList,
|
||||
}
|
||||
|
||||
const getOtherSourcePromises = new Map()
|
||||
|
||||
// actions
|
||||
const actions = {
|
||||
getOtherSource({ state, commit }, musicInfo) {
|
||||
return (musicInfo.otherSource && musicInfo.otherSource.length ? Promise.resolve(musicInfo.otherSource) : musicSdk.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 = musicSdk.findMusic(musicInfo).then(otherSource => {
|
||||
commit('setOtherSource', { musicInfo, otherSource })
|
||||
if (getOtherSourcePromises.has(key)) getOtherSourcePromises.delete(key)
|
||||
return otherSource
|
||||
})
|
||||
getOtherSourcePromises.set(key, promise)
|
||||
return promise
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue