Merged in fix/destination-pages-cache-keys (pull request #1642)

Fix/destination pages cache keys

* fix(destionationpages): add tag to citydatabycityidentifier that should invalidate when publishing city

* Fixed building tag the same way and added comment why we need this extra tag


Approved-by: Erik Tiekstra
This commit is contained in:
Linus Flood
2025-03-26 13:04:18 +00:00
parent ee741cc0e8
commit 3456235dd0
4 changed files with 20 additions and 1 deletions

View File

@@ -89,6 +89,19 @@ query GetDestinationCityPage($locale: String!, $uid: String!) {
query GetDestinationCityPageRefs($locale: String!, $uid: String!) {
destination_city_page(locale: $locale, uid: $uid) {
destination_settings {
city_denmark
city_finland
city_germany
city_norway
city_poland
city_sweden
location {
longitude
latitude
default_zoom
}
}
sidepeek_content {
content {
embedded_itemsConnection {

View File

@@ -232,6 +232,7 @@ const blocksRefsSchema = z.discriminatedUnion("__typename", [
export const destinationCityPageRefsSchema = z.object({
destination_city_page: z.object({
destination_settings: destinationCityPageDestinationSettingsSchema,
sidepeek_content: z
.object({
content: z.object({

View File

@@ -29,6 +29,11 @@ export function generatePageTags(
): string[] {
const connections = getConnections(validatedData)
return [
// This tag is added for the city list data on country pages to invalidate the list when city page changes.
generateTag(
lang,
`city_list_data:${validatedData.destination_city_page.destination_settings.city}`
),
generateTagsFromSystem(lang, connections),
generateTag(lang, validatedData.destination_city_page.system.uid),
].flat()

View File

@@ -90,7 +90,7 @@ export async function getCityListDataByCityIdentifier(
cityIdentifier,
},
{
key: `${lang}:city_list_data:${cityIdentifier}`,
key: generateTag(lang, `city_list_data:${cityIdentifier}`),
ttl: "max",
}
)