Files
stripstream/src/app/actions/refresh.ts
Froidefond Julien 7d0f1c4457
Some checks failed
Deploy with Docker Compose / deploy (push) Has been cancelled
feat: add multi-provider support (Komga + Stripstream Librarian)
- Introduce provider abstraction layer (IMediaProvider, KomgaProvider, StripstreamProvider)
- Add Stripstream Librarian as second media provider with full feature parity
- Migrate all pages and components from direct Komga services to provider factory
- Remove dead service code (BaseApiService, HomeService, LibraryService, SearchService, TestService)
- Fix library/series page-based pagination for both providers (Komga 0-indexed, Stripstream 1-indexed)
- Fix unread filter and search on library page for both providers
- Fix read progress display for Stripstream (reading_status mapping)
- Fix series read status (books_read_count) for Stripstream
- Add global search with series results for Stripstream (series_hits from Meilisearch)
- Fix thumbnail proxy to return 404 gracefully instead of JSON on upstream error
- Replace duration-based cache debug detection with x-nextjs-cache header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 11:48:17 +01:00

31 lines
913 B
TypeScript

"use server";
import { revalidatePath, revalidateTag } from "next/cache";
import { HOME_CACHE_TAG, LIBRARY_SERIES_CACHE_TAG } from "@/constants/cacheConstants";
export type RefreshScope = "home" | "library" | "series";
/**
* Invalide le cache Next.js pour forcer un re-fetch au prochain router.refresh().
* À appeler côté client avant router.refresh() sur les boutons / pull-to-refresh.
*/
export async function revalidateForRefresh(scope: RefreshScope, id: string): Promise<void> {
switch (scope) {
case "home":
revalidateTag(HOME_CACHE_TAG, "max");
revalidatePath("/");
break;
case "library":
revalidateTag(LIBRARY_SERIES_CACHE_TAG, "max");
revalidatePath(`/libraries/${id}`);
revalidatePath("/libraries");
break;
case "series":
revalidatePath(`/series/${id}`);
revalidatePath("/series");
break;
default:
break;
}
}