From 6001ed0141142a3dedc3697d32b577604b704034 Mon Sep 17 00:00:00 2001 From: Yucked Date: Tue, 21 Nov 2023 20:36:14 -0500 Subject: [PATCH] fixed a stupid bug --- src/Handlers/DatabaseHandler.cs | 5 +++-- src/Pages/MangaPage.razor | 2 +- src/Pages/SourcePage.razor | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) 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 {