Issue 479
Category edits don't refresh cached pages (home strip, event filters)
Back to our planOpen
bugfrontendcmspriority: low
Type
bug
Problem
The news module's categories collection has no revalidation hook. If an editor renames or deletes a category, or changes its slug, the cached pages that show it keep the old version for up to 10 minutes, until ISR runs. Those pages are:
- the home page's "this week" strip (#477), whose "See all <Category> events" link can lead to a 404 in that window
- the
/eventsfilter row and the category pages (#473)
The review of #477 raised this (Minor 2).
Proposed fix
Add afterChange and afterDelete hooks to categories that:
- skip when
context.disableRevalidateis set - call
revalidatePath('/') - call
revalidatePath('/(frontend)/[slug]', 'page') - refresh the events listing and category route patterns that
revalidateEventalready refreshes
Reuse one helper rather than copying the list. news must not import events internals, so check the dependency rules and put the shared pattern list where both modules may use it, or compose the hook in payload.config.ts.
Acceptance criteria
- Renaming, changing the slug of, or deleting a category refreshes
/, the CMS pages and the events filter pages on their next visit. - A test checks that each refreshed pattern names a real page, as
revalidateEvent.test.tsdoes. - The dependency lint passes.
Area
frontend, cms
Priority
low
Generated by Claude Code, opens in a new tab