small ui changes
This commit is contained in:
@@ -65,6 +65,14 @@ export class PlaylistController implements ReactiveController {
|
||||
playlistStore.setScrollPosition(offset);
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
// REFETCH
|
||||
// ===================================================================
|
||||
|
||||
async refetch(): Promise<playlist.WithTracks[]> {
|
||||
return playlistStore.refetch();
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
// INVALIDATION
|
||||
// ===================================================================
|
||||
|
||||
@@ -90,6 +90,31 @@ class PlaylistStore {
|
||||
this.scrollPosition = offset;
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
// REFETCH
|
||||
// Fetches fresh data without clearing the cache first, so existing
|
||||
// consumers keep rendering stale data until the new data arrives.
|
||||
// ===================================================================
|
||||
|
||||
async refetch(): Promise<playlist.WithTracks[]> {
|
||||
if (this.playlistsLoading) {
|
||||
return this.waitForPlaylists();
|
||||
}
|
||||
|
||||
this.playlistsLoading = true;
|
||||
|
||||
try {
|
||||
const result =
|
||||
await GetAllPlaylistsWithTracks();
|
||||
this.playlists = result ?? [];
|
||||
|
||||
return this.playlists;
|
||||
} finally {
|
||||
this.playlistsLoading = false;
|
||||
this.notify();
|
||||
}
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
// INVALIDATION
|
||||
// ===================================================================
|
||||
|
||||
Reference in New Issue
Block a user