@@ -4,7 +4,7 @@ import { getDrizzle } from "./drizzle";
44import { chat , diff , message , section } from "@/schema/chat" ;
55import { and , asc , eq , exists } from "drizzle-orm" ;
66import { Auth } from "better-auth" ;
7- import { revalidateTag } from "next/cache" ;
7+ import { updateTag } from "next/cache" ;
88import { isCloudflare } from "./detectCloudflare" ;
99import { getPagesList , LangId , PagePath , PageSlug , SectionId } from "./docs" ;
1010
@@ -31,7 +31,6 @@ export function cacheKeyForChat(chatId: string) {
3131// nextjsのキャッシュのrevalidateはRouteHandlerではなくServerActionから呼ばないと正しく動作しないらしい。
3232// https://github.com/vercel/next.js/issues/69064
3333// そのためlib/以下の関数では直接revalidateChatを呼ばず、ServerActionの関数から呼ぶようにする。
34- // Nextjs 16 に更新したらこれをupdateTag()で置き換える。
3534export async function revalidateChat (
3635 chatId : string ,
3736 userId : string ,
@@ -41,8 +40,8 @@ export async function revalidateChat(
4140 const [ lang , page ] = pagePath . split ( "/" ) as [ LangId , PageSlug ] ;
4241 pagePath = { lang, page } ;
4342 }
44- revalidateTag ( cacheKeyForChat ( chatId ) ) ;
45- revalidateTag ( cacheKeyForPage ( pagePath , userId ) ) ;
43+ updateTag ( cacheKeyForChat ( chatId ) ) ;
44+ updateTag ( cacheKeyForPage ( pagePath , userId ) ) ;
4645 if ( isCloudflare ( ) ) {
4746 const cache = await caches . open ( "chatHistory" ) ;
4847 await cache . delete ( cacheKeyForChat ( chatId ) ) ;
0 commit comments