Fix: Optimized KeywordTab with BlobURL like TagTab

This commit is contained in:
Youwes09
2026-04-28 23:45:35 -05:00
parent 4df7f416a7
commit c009bd71fc
2 changed files with 9 additions and 0 deletions
@@ -5,8 +5,10 @@
import { runConcurrent } from "@core/async/batchRequests"; import { runConcurrent } from "@core/async/batchRequests";
import { shouldHideNsfw, shouldHideSource, dedupeMangaById, dedupeMangaByTitle } from "@core/util"; import { shouldHideNsfw, shouldHideSource, dedupeMangaById, dedupeMangaByTitle } from "@core/util";
import { store } from "@store/state.svelte"; import { store } from "@store/state.svelte";
import { preloadBlobUrls } from "@core/cache/imageCache";
import Thumbnail from "@shared/manga/Thumbnail.svelte"; import Thumbnail from "@shared/manga/Thumbnail.svelte";
import type { Manga, Source } from "@types"; import type { Manga, Source } from "@types";
import type { CachedManga } from "@features/discover/lib/searchFilter";
interface Props { interface Props {
allSources: Source[]; allSources: Source[];
@@ -16,12 +18,14 @@
pendingPrefill: string; pendingPrefill: string;
popularResults: (Manga & { _priority: number })[]; popularResults: (Manga & { _priority: number })[];
popularLoading: boolean; popularLoading: boolean;
sourceCache: Map<number, CachedManga>;
onPrefillConsumed: () => void; onPrefillConsumed: () => void;
onPreview: (m: Manga) => void; onPreview: (m: Manga) => void;
} }
let { let {
allSources, availableLangs, hasMultipleLangs, loadingSources, allSources, availableLangs, hasMultipleLangs, loadingSources,
pendingPrefill, popularResults, popularLoading, pendingPrefill, popularResults, popularLoading,
sourceCache,
onPrefillConsumed, onPreview, onPrefillConsumed, onPreview,
}: Props = $props(); }: Props = $props();
@@ -99,6 +103,10 @@
); );
if (ctrl.signal.aborted) return; if (ctrl.signal.aborted) return;
const mangas = d.fetchSourceManga.mangas.filter((m) => !shouldHideNsfw(m, store.settings)); const mangas = d.fetchSourceManga.mangas.filter((m) => !shouldHideNsfw(m, store.settings));
preloadBlobUrls(
mangas.map((m) => sourceCache.get(m.id)?.thumbnailUrl ?? m.thumbnailUrl),
12,
);
const next = [...kw_results]; const next = [...kw_results];
next[idx] = { ...next[idx], mangas, loading: false }; next[idx] = { ...next[idx], mangas, loading: false };
kw_results = next; kw_results = next;
@@ -287,6 +287,7 @@
{pendingPrefill} {pendingPrefill}
popularResults={popular_results} popularResults={popular_results}
popularLoading={popular_loading} popularLoading={popular_loading}
{sourceCache}
onPrefillConsumed={() => (pendingPrefill = "")} onPrefillConsumed={() => (pendingPrefill = "")}
onPreview={setPreviewManga} onPreview={setPreviewManga}
/> />