Run GetShowsAsync in the background

This allows for faster startup because initializing and checking the cache doesn't block the UI thread.
pull/57/head
Eric Erhardt 2022-03-28 13:50:09 -05:00
parent 9ac4b5643b
commit 4ae65e91df
1 changed files with 3 additions and 1 deletions

View File

@ -49,7 +49,9 @@ public class DiscoverViewModel : BaseViewModel
private async Task FetchAsync() private async Task FetchAsync()
{ {
var podcastsModels = await showsService.GetShowsAsync(); // run GetShowsAsync in the background, so things get initialized in the background
// like checking the cache and the web request
var podcastsModels = await Task.Run(() => showsService.GetShowsAsync());
if (podcastsModels == null) if (podcastsModels == null)
{ {