web: adopt Cache Components, Partial Prefetching and ensureStatic
web / ci (push) Successful in 2m2s
web / ci (push) Successful in 2m2s
This commit is contained in:
70 files changed
+1285
-316
No files matched your search
@@ -10,6 +10,7 @@ import type {
|
||||
AllAssociationsQuery,
|
||||
AllGenericSlugsQuery,
|
||||
AllVenueSlugsQuery,
|
||||
LatestPageSlugQuery,
|
||||
AssociationBySlugQuery,
|
||||
AssociationFragment,
|
||||
AssociationIndexFragment,
|
||||
@@ -53,6 +54,8 @@ import type {
|
||||
|
||||
export type MockState = {
|
||||
newsHeadlineVersion: "v1" | "v2";
|
||||
// how long the CMS takes to answer newsBySlug, to hold a page render open
|
||||
newsDelayMs?: number;
|
||||
};
|
||||
|
||||
export const SLUGS = {
|
||||
@@ -60,6 +63,8 @@ export const SLUGS = {
|
||||
association: "testforening",
|
||||
venue: "storsalen",
|
||||
news: "test-artikkel",
|
||||
// exists in the CMS but is not prerendered: rendered on first request
|
||||
newsOnDemand: "eldre-artikkel",
|
||||
event: "testkonsert",
|
||||
} as const;
|
||||
|
||||
@@ -98,7 +103,7 @@ export function makeFixtures(cmsBaseUrl: string): Fixtures {
|
||||
__typename: "EventCategory",
|
||||
name: "Konsert",
|
||||
slug: "konsert",
|
||||
pig: "PIG_PINK",
|
||||
pig: "music",
|
||||
showInFilters: true,
|
||||
} satisfies EventCategoryFragment;
|
||||
|
||||
@@ -158,7 +163,8 @@ export function makeFixtures(cmsBaseUrl: string): Fixtures {
|
||||
seoTitle: "Testkonsert",
|
||||
searchDescription: null,
|
||||
lead: "Bli med på testkonsert.",
|
||||
pig: "PIG_PINK",
|
||||
// picks a pig from the event's categories, which must be prerenderable
|
||||
pig: "automatic",
|
||||
facebookUrl: null,
|
||||
ticketUrl: null,
|
||||
free: true,
|
||||
@@ -344,6 +350,15 @@ export function makeFixtures(cmsBaseUrl: string): Fixtures {
|
||||
({
|
||||
pages: [{ id: "30", slug: SLUGS.venue }],
|
||||
}) satisfies AllVenueSlugsQuery,
|
||||
latestPageSlug: (vars) =>
|
||||
({
|
||||
pages:
|
||||
vars.contentType === "news.NewsPage"
|
||||
? [{ id: "20", slug: SLUGS.news }]
|
||||
: vars.contentType === "events.EventPage"
|
||||
? [{ id: "10", slug: SLUGS.event }]
|
||||
: [],
|
||||
}) satisfies LatestPageSlugQuery,
|
||||
|
||||
// --- build time: static pages ---
|
||||
home: (_vars, state) =>
|
||||
@@ -412,7 +427,10 @@ export function makeFixtures(cmsBaseUrl: string): Fixtures {
|
||||
// --- runtime ---
|
||||
newsBySlug: (vars, state) =>
|
||||
({
|
||||
news: vars.slug === SLUGS.news ? mask(newsPage(state)) : null,
|
||||
news:
|
||||
vars.slug === SLUGS.news || vars.slug === SLUGS.newsOnDemand
|
||||
? mask(newsPage(state))
|
||||
: null,
|
||||
}) satisfies NewsBySlugQuery,
|
||||
eventBySlug: (vars) =>
|
||||
({
|
||||
|
||||
Reference in new issue
Block a user