mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-07-07 18:07:32 +08:00
fix(playlist): 歌单增删歌曲后刷新用户歌单列表
添加/删除成功后调用 initializePlaylist 重新拉取,用户页与详情页的 歌曲总数(trackCount)会话内即时更新;重启后仍滞后属网易服务端缓存, 客户端无法根治。 Closes #508
This commit is contained in:
@@ -235,6 +235,8 @@ const handleAddToPlaylist = async (playlist: any) => {
|
||||
if (res.status === 200) {
|
||||
message.success(t('comp.playlistDrawer.addSuccess'));
|
||||
emit('update:modelValue', false);
|
||||
// 刷新用户歌单列表,让用户页/详情页的歌曲总数(trackCount)及时更新(#508)
|
||||
store.initializePlaylist().catch(() => {});
|
||||
} else {
|
||||
throw new Error(res.data?.msg || t('comp.playlistDrawer.addFailed'));
|
||||
}
|
||||
|
||||
@@ -631,6 +631,8 @@ const handleRemoveSong = async (songId: number) => {
|
||||
displayedSongs.value = displayedSongs.value.filter((s) => s.id !== songId);
|
||||
completePlaylist.value = completePlaylist.value.filter((s) => s.id !== songId);
|
||||
musicStore.removeSongFromList(songId);
|
||||
// 刷新用户歌单列表,让用户页的歌曲总数(trackCount)及时更新(#508)
|
||||
userStore.initializePlaylist().catch(() => {});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('删除歌曲失败:', error);
|
||||
|
||||
Reference in New Issue
Block a user