From 9a42df42eae1cc711e592e7c9e903c25d024d83c Mon Sep 17 00:00:00 2001 From: SnowySailor Date: Sun, 6 Oct 2024 17:07:46 -0400 Subject: [PATCH] revalidatePath on reading progress update --- .../(application)/reader/[seriesId]/[volumeNum]/functions.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/(application)/reader/[seriesId]/[volumeNum]/functions.ts b/src/app/(application)/reader/[seriesId]/[volumeNum]/functions.ts index 17ad69f..476108e 100644 --- a/src/app/(application)/reader/[seriesId]/[volumeNum]/functions.ts +++ b/src/app/(application)/reader/[seriesId]/[volumeNum]/functions.ts @@ -3,6 +3,7 @@ import { ReadingSelectQuery, Reading } from 'lib/reading'; import prisma from 'db'; import { getSession } from 'lib/session'; +import { revalidatePath } from 'next/cache'; const updateReadingInDb = async ( reading: Reading | null, @@ -58,5 +59,7 @@ export const updateReadingProgress = async (volumeId: number, page: number) => { select: ReadingSelectQuery, }); - return updateReadingInDb(reading, volumeId, page, userId); + const updatedReading = await updateReadingInDb(reading, volumeId, page, userId); + revalidatePath(`/reader/${updatedReading!.volume.seriesId}/${volumeId}/`); + return updatedReading; };