diff --git a/src/Handlers/DatabaseHandler.cs b/src/Handlers/DatabaseHandler.cs index 0843a39..8a86585 100644 --- a/src/Handlers/DatabaseHandler.cs +++ b/src/Handlers/DatabaseHandler.cs @@ -95,7 +95,8 @@ public async Task GetMangaAsync(string sourceId, string mangaId) { } public async Task> GetMangasAsync(string sourceId, bool fetchUpdates) { - var mangas = fetchUpdates + var collections = await (await database.ListCollectionNamesAsync()).ToListAsync(); + var mangas = fetchUpdates || !collections.Contains(sourceId) ? await _sources .First(x => x.Id == sourceId) .GetMangasAsync() @@ -133,7 +134,7 @@ public async Task> GetMangasAsync(string sourceId, bo memoryCache.Set($"{sourceId}@{manga.Id}", path.WithCover(manga.Cover)); } - if (fetchUpdates) { + if (fetchUpdates || !collections.Contains(sourceId)) { await database .GetCollection(manga.SourceId) .ReplaceOneAsync(r => r.Id == manga.Id, diff --git a/src/Pages/MangaPage.razor b/src/Pages/MangaPage.razor index ef9bb03..88d1a9f 100644 --- a/src/Pages/MangaPage.razor +++ b/src/Pages/MangaPage.razor @@ -71,7 +71,7 @@ else {