Repository navigation
fix(cms): revalidate every locale when a page or post is published, unpublished or deleted - #219
Merged
Merged
Conversation
…npublished or deleted `_status` is not localized, but the page and post revalidation hooks only invalidated the locale from the request's ?locale= (default en). Deleting or unpublishing a document left its other locales served from the data cache, so /es/<slug> kept returning 200 after the page was deleted. Status changes and deletes now invalidate all locales; content edits of a published document still invalidate only the edited locale. revalidatePageCache takes a list of locales. Scopes: apps/cms Page and Posts revalidation hooks, Header/Footer/GlobalBlock callers, lib/config/i18n, lib/utils/revalidatePageCache, tests/int.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dogfrogfog
requested review from
ChiefCreator and
SearheiParkhamchuk
as code owners
October 28, 2026 15:00
|
🎉 This PR is included in version 0.18.1 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.4.0 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Page.\_statusis not localized, but the page and post revalidation hooks invalidated only the locale from the request (?locale=, defaulten).After deleting or unpublishing a document, its other locales stayed in the Next data cache.
Observed on the live site: after a test page was deleted with a REST
DELETE(no?locale),/test-hero-checkreturned 404 but/es/test-hero-checkkept returning 200 with the deleted content.A delete from the admin panel has the same problem, because the request carries only the current locale.
Fix
ALL_LOCALES, fromI18N_CONFIG).revalidatePageCachetakeslocalesinstead of onelocale. The Header, Footer and Global Block callers pass[locale], so their behaviour does not change.Verified
tests/int/revalidatePage.int.spec.ts(4 tests): delete, unpublish and publish revalidate both locales, and a content edit revalidates only its own locale.check-typespasses andlintreports 0 errors.api.int.spec.tswas not run here: it needsPAYLOAD_SECRETand a database.