Skip to content

Commit 39fff5b

Browse files
Zeff01claude
andcommitted
fix: add cache invalidation when toggling project bookmark
- Import invalidateCache and cacheKeys for Redis cache management - Invalidate projects cache (cacheKeys.projects.all) when public_display is toggled - Add revalidatePath for /services page to update both home and services pages - Ensure bookmark changes immediately reflect on services page This fixes the issue where unbookmarked projects still appeared on services page due to Redis cache not being invalidated when bookmark state changed. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ac79334 commit 39fff5b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎apps/codebility/app/home/projects/actions.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { revalidatePath } from "next/cache";
44
import { Client, Codev, Project } from "@/types/home/codev";
55
import { deleteImage, getImagePath } from "@/utils/uploadImage";
66
import { createClientServerComponent } from "@/utils/supabase/server";
7+
import { invalidateCache } from "@/lib/server/redis-cache";
8+
import { cacheKeys } from "@/lib/server/redis-cache-keys";
79

810
interface DbProjectMember {
911
project: {
@@ -300,7 +302,12 @@ export async function updatePublicDisplaySwitch(
300302
if (projectError)
301303
console.error("Error in updating projects and kanban board:", projectError);
302304

305+
// Invalidate Redis cache for projects
306+
await invalidateCache(cacheKeys.projects.all);
307+
308+
// Revalidate both home projects and services pages
303309
revalidatePath("/home/projects");
310+
revalidatePath("/services");
304311

305312
return { success: true, projectId, publicDisplay };
306313
}

0 commit comments

Comments
 (0)