修改列表响应式更新机制,尝试修复偶现的删除歌曲列表未更新的问题

pull/1211/head
lyswhut 2023-02-03 19:41:22 +08:00
parent c6f9e421c1
commit 4635481c77
3 changed files with 18 additions and 4 deletions

View File

@ -14,4 +14,5 @@
### 修复
- 修复播放下载列表的歌曲时,调整歌词偏移时间功能异常的问题
- 修复较旧Linux arm64系统下无法启动软件的问题将预构建模块的编译器版本降级glibc到2.27#1161
- 修复较旧Linux arm64系统下无法启动软件的问题将预构建模块的所需glibc版本降级到2.27#1161
- 修改列表响应式更新机制,尝试修复偶现的删除歌曲列表未更新的问题

View File

@ -25,7 +25,7 @@ export default (activeTab) => {
case 'finished':
return listAll.value.filter(i => i.status == downloadStatus.COMPLETED)
default:
return listAll.value
return [...listAll.value]
}
})

View File

@ -1,4 +1,4 @@
import { ref, watch, computed } from '@common/utils/vueTools'
import { ref, watch, computed, onBeforeUnmount } from '@common/utils/vueTools'
import { playMusicInfo, playInfo } from '@renderer/store/player/state'
import { getListMusics } from '@renderer/store/list/action'
import { appSetting } from '@renderer/store/setting'
@ -16,7 +16,7 @@ export default ({ props, onLoadedList }) => {
const list = ref([])
watch(() => props.listId, id => {
getListMusics(id).then(l => {
list.value = l
list.value = [...l]
if (id != props.listId) return
onLoadedList()
})
@ -35,6 +35,19 @@ export default ({ props, onLoadedList }) => {
const isShowSource = computed(() => appSetting['list.isShowSource'])
const handleMyListUpdate = (ids) => {
if (!ids.includes(props.listId)) return
getListMusics(props.listId).then(l => {
list.value = [...l]
})
}
window.app_event.on('myListUpdate', handleMyListUpdate)
onBeforeUnmount(() => {
window.app_event.off('myListUpdate', handleMyListUpdate)
})
return {
rightClickSelectedIndex,
selectedIndex,