Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 5465efe

Browse files
committed
Fix playlist force refresh
1 parent a6b0c45 commit 5465efe

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

src/mainWindow/pages/playlists/single.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,21 @@ export default class SinglePlaylistView extends mixins(ContextMenuMixin, Provide
108108
return !!(this.isYoutube || this.isSpotify || this.isExtension)
109109
}
110110
111-
private async refresh() {
111+
private async clearAndFetch() {
112112
this.clearSongList()
113113
this.clearNextPageTokens()
114114
115115
await this.fetchSongList()
116116
}
117117
118+
private async refresh() {
119+
for (const [key, checked] of Object.entries(this.activeProviders)) {
120+
if (checked) {
121+
await this.onProviderChanged({key, checked})
122+
}
123+
}
124+
}
125+
118126
async created() {
119127
this.providers = this.getProvidersByScope(ProviderScopes.PLAYLIST_SONGS)
120128
@@ -127,6 +135,7 @@ export default class SinglePlaylistView extends mixins(ContextMenuMixin, Provide
127135
})
128136
129137
this.generator = (provider, nextPageToken) => {
138+
console.log(this.playlist)
130139
if (this.playlist) {
131140
return provider.getPlaylistContent(
132141
provider.sanitizeId(this.playlist.playlist_id, 'PLAYLIST'),
@@ -153,13 +162,14 @@ export default class SinglePlaylistView extends mixins(ContextMenuMixin, Provide
153162
mounted() {
154163
this.enableRefresh()
155164
this.listenGlobalRefresh()
156-
this.refresh()
165+
this.clearAndFetch()
157166
}
158167
159168
private listenGlobalRefresh() {
160-
bus.on(EventBus.REFRESH_PAGE, () => {
169+
bus.on(EventBus.REFRESH_PAGE, async () => {
161170
this.invalidateCache = true
162-
this.refresh()
171+
await this.clearAndFetch()
172+
await this.refresh()
163173
})
164174
}
165175

0 commit comments

Comments
 (0)