fix: inverted tag expiration in Redis handler + saveItemOptions board name
- Fix critical bug: tag expiration comparison was inverted (< should be >) in Redis cache handler, which would prevent revalidateTag from clearing stale entries - Pass board name to invalidateBoardCache in saveItemOptions - Add clarifying comment about two-tier invalidation helpers
This commit is contained in:
3 files changed
+12
-2
No files matched your search
@@ -1,6 +1,12 @@
|
||||
// ponytail: invalidation is wired now; `cacheTag()` on RSC read paths is Phase 1 follow-up.
|
||||
// Until reads use `"use cache"` + `cacheTag()`, these calls affect only Next.js-internal
|
||||
// cached segments (layout shells, static params) via cacheComponents, not cross-request DB queries.
|
||||
//
|
||||
// Two-tier invalidation:
|
||||
// - `invalidateIntegrationCache`: for integration CONFIG changes (CRUD, permissions).
|
||||
// Clears module cache + Next tags + Redis session store.
|
||||
// - `invalidateIntegrationDataCache` (from integration-data-cache.ts): for integration DATA changes
|
||||
// (widget interact mutations). Clears module cache only — pair with requestHandler.invalidateCache().
|
||||
|
||||
import { revalidateTag } from "next/cache";
|
||||
|
||||
|
||||
@@ -53,6 +53,10 @@ export const optionsRouter = createTRPCRouter({
|
||||
.set({ options: SuperJSON.stringify(options) })
|
||||
.where(eq(items.id, input.itemId));
|
||||
|
||||
invalidateBoardCache(input.boardId);
|
||||
const board = await ctx.db.query.boards.findFirst({
|
||||
where: eq(boards.id, input.boardId),
|
||||
columns: { name: true },
|
||||
});
|
||||
invalidateBoardCache(input.boardId, board?.name);
|
||||
}),
|
||||
});
|
||||
@@ -57,7 +57,7 @@ export class RedisCacheHandler implements CacheHandler {
|
||||
|
||||
const allTags = [...parsed.tags, ...softTags];
|
||||
const expiration = await this.getExpiration(allTags);
|
||||
if (expiration !== 0 && expiration < parsed.timestamp) {
|
||||
if (expiration !== 0 && expiration > parsed.timestamp) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user