fix: revalidate /libraries cache after settings updates
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 42s

Add revalidatePath("/libraries") to the monitoring, metadata-provider
and reading-status-provider route handlers so that saving library
settings invalidates the Next.js data cache and the page reflects
fresh data on reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 12:51:16 +01:00
parent d893702909
commit 5ba4315e98
3 changed files with 6 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
import { revalidatePath } from "next/cache";
import { NextRequest, NextResponse } from "next/server";
import { apiFetch, LibraryDto } from "@/lib/api";
@@ -12,6 +13,7 @@ export async function PATCH(
method: "PATCH",
body: JSON.stringify(body),
});
revalidatePath("/libraries");
return NextResponse.json(data);
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to update metadata provider";

View File

@@ -1,3 +1,4 @@
import { revalidatePath } from "next/cache";
import { NextRequest, NextResponse } from "next/server";
import { updateLibraryMonitoring } from "@/lib/api";
@@ -9,6 +10,7 @@ export async function PATCH(
try {
const { monitor_enabled, scan_mode, watcher_enabled, metadata_refresh_mode } = await request.json();
const data = await updateLibraryMonitoring(id, monitor_enabled, scan_mode, watcher_enabled, metadata_refresh_mode);
revalidatePath("/libraries");
return NextResponse.json(data);
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to update monitoring settings";

View File

@@ -1,3 +1,4 @@
import { revalidatePath } from "next/cache";
import { NextResponse } from "next/server";
import { apiFetch } from "@/lib/api";
@@ -13,6 +14,7 @@ export async function PATCH(
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
revalidatePath("/libraries");
return NextResponse.json(data);
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to update reading status provider";