Skip to content

Commit e697221

Browse files
authored
Merge pull request #1182 from team-mirai/fix/webapp-cache-invalidation-tags
fix: unstable_cacheにtags未指定でキャッシュクリアが効かない問題を修正
2 parents 29ea4cc + 95e5a92 commit e697221

4 files changed

Lines changed: 5 additions & 6 deletions

File tree

webapp/src/app/api/refresh/route.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import "server-only";
2-
import { revalidatePath, revalidateTag } from "next/cache";
2+
import { revalidateTag } from "next/cache";
33
import { type NextRequest, NextResponse } from "next/server";
44

55
export async function POST(request: NextRequest) {
@@ -20,9 +20,7 @@ export async function POST(request: NextRequest) {
2020
revalidateTag("transactions-page-data", "max");
2121
revalidateTag("transactions-for-csv", "max");
2222
revalidateTag("top-page-data", "max");
23-
24-
revalidatePath("/transactions");
25-
revalidatePath("/");
23+
revalidateTag("organizations", "max");
2624

2725
return NextResponse.json({
2826
success: true,

webapp/src/server/contexts/public-finance/presentation/loaders/load-organizations.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ export const loadOrganizations = unstable_cache(
1515
["organizations"],
1616
{
1717
revalidate: CACHE_REVALIDATE_SECONDS,
18+
tags: ["organizations"],
1819
},
1920
);

webapp/src/server/contexts/public-finance/presentation/loaders/load-top-page-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ export const loadTopPageData = unstable_cache(
9898
};
9999
},
100100
["top-page-data"],
101-
{ revalidate: CACHE_REVALIDATE_SECONDS },
101+
{ revalidate: CACHE_REVALIDATE_SECONDS, tags: ["top-page-data"] },
102102
);

webapp/src/server/contexts/public-finance/presentation/loaders/load-transactions-page-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ export const loadTransactionsPageData = (params: GetTransactionsBySlugParams) =>
2525
return await usecase.execute(params);
2626
},
2727
cacheKey,
28-
{ revalidate: CACHE_REVALIDATE_SECONDS },
28+
{ revalidate: CACHE_REVALIDATE_SECONDS, tags: ["transactions-page-data"] },
2929
)();
3030
};

0 commit comments

Comments
 (0)