fix: surface search failures

This commit is contained in:
2026-06-16 01:23:41 +02:00
committed by Milas Holsting
parent d2a3b0ccda
commit c1e313d684
2 changed files with 31 additions and 7 deletions

View File

@@ -160,8 +160,8 @@ export const removeContinueWatchingItem = (item: CommandPaletteItem): void => {
removeContinueWatchingCard(animeID);
renderItems(getResultItems().filter((candidate) => candidate.id !== item.id));
})
.catch((err: unknown) => {
console.error("Continue watching remove error:", err);
.catch(() => {
window.showToast?.({ message: "Failed to remove from Continue Watching." });
});
};
@@ -316,6 +316,30 @@ export const renderEmptyState = (query: string): void => {
searchResults.replaceChildren(empty);
};
export const renderSearchErrorState = (query: string): void => {
if (!searchResults) {
return;
}
const empty = document.createElement("div");
empty.className =
"mx-auto flex min-h-80 w-full max-w-5xl flex-col justify-center px-5 py-14 text-center md:px-8";
const title = document.createElement("div");
title.className = "text-2xl font-semibold text-foreground";
title.textContent = "Search is unavailable right now";
empty.appendChild(title);
const subtitle = document.createElement("p");
subtitle.className = "mx-auto mt-3 max-w-lg text-sm leading-6 text-foreground-muted";
subtitle.textContent = query
? "Try again in a moment or narrow the search query."
: "Try again in a moment.";
empty.appendChild(subtitle);
searchResults.replaceChildren(empty);
};
const groupedItems = (items: CommandPaletteItem[]): Map<string, CommandPaletteItem[]> => {
const groups = new Map<string, CommandPaletteItem[]>();
items.forEach((item) => {