fix: harden production flows and user messaging

This commit is contained in:
Leon Tonhäuser committed 2026-08-11 16:07:13 +02:00
1 parent 52dce168dd
commit 86dfe8053d
43 files changed
+3520 -358

No files matched your search

+5 -2
View File
@@ -158,7 +158,10 @@ async function loadAlbumPage({
const lightboxAssetIds = new Set(lightboxItems.map((i) => i.assetId));
return { album, page: resultPage, currentPage, downloadOptions, lightboxAssetIds, unavailable: false as const };
} catch (error) {
if (error instanceof AlbumCatalogError && error.code === "IMMICH_UNAVAILABLE") {
if (
error instanceof AlbumCatalogError &&
(error.code === "IMMICH_UNAVAILABLE" || error.code === "RATE_LIMITED")
) {
return { album: null, page: null, currentPage: 1, downloadOptions: undefined, lightboxAssetIds: new Set<string>(), unavailable: true as const };
}
throw error;
@@ -190,4 +193,4 @@ function ImmichUnavailable() {
</PageHeader>
</section>
);
}
}
+25 -5
View File
@@ -23,11 +23,19 @@ export default async function AlbumsPage({ searchParams }: { searchParams: Promi
const jahr = singleValue(rawSearchParams.jahr);
if (query) {
const results = await albumCatalog.searchVisiblePhotos(principal.editorialId, {
description: query,
page: 1,
size: SEARCH_FETCH_SIZE,
});
let results;
try {
results = await albumCatalog.searchVisiblePhotos(principal.editorialId, {
description: query,
page: 1,
size: SEARCH_FETCH_SIZE,
});
} catch (error) {
if (error instanceof AlbumCatalogError && error.code === "RATE_LIMITED") {
return <SearchRateLimited query={query} format={format} jahr={jahr} />;
}
throw error;
}
const filtered = filterPhotos(results.items, { format, jahr });
const { result: page, currentPage } = paginatePhotos(filtered, singleValue(rawSearchParams.page), PHOTO_PAGE_SIZE);
@@ -86,6 +94,18 @@ export default async function AlbumsPage({ searchParams }: { searchParams: Promi
);
}
function SearchRateLimited({ query, format, jahr }: { query: string; format?: string; jahr?: string }) {
return (
<div className="space-y-6 max-w-7xl" aria-labelledby="albums-title">
<PageHeader kicker="Bildarchiv · Suche" title="Bitte kurz warten" titleId="albums-title" />
<GlobalSearchForm query={query} format={format} jahr={jahr} />
<p className="bg-muted p-4 rounded-md" role="status">
Es wurden sehr viele Suchanfragen gestellt. Bitte versuchen Sie es in Kürze erneut.
</p>
</div>
);
}
function GlobalSearchForm({ query, format, jahr }: { query: string; format?: string; jahr?: string; }) {
const currentYear = new Date().getFullYear();
const years = Array.from({ length: 10 }, (_, i) => currentYear - i);