Site Settings read at depth 1; archive page re-fetched at page depth
getSettings ran findGlobal at depth 2 on every request, pulling the relations of every page a project field links to (menus). Depth 1 keeps slug/title. The archive page itself was rendered from the settings copy, which maxDepth caps at 1, so its media never populated; resolveRoute now re-fetches it at depth 2 like the homepage. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8e10232765
commit
561a9e2bb7
@@ -188,10 +188,15 @@ export function createContentHelpers({
|
||||
/**
|
||||
* SiteSettings for a locale — ONE query per locale per request, shared by the
|
||||
* layout, generatePageMetadata, resolveRoute and anything else that asks.
|
||||
*
|
||||
* Depth 1: logos and assigned pages arrive as documents (slug, title), but
|
||||
* not THEIR relations. Depth 2 pulled every assigned page's blocks and media
|
||||
* (homepage, archives, system pages) into every request; resolveRoute
|
||||
* re-fetches the one page it actually renders.
|
||||
*/
|
||||
const getSettings = cache(async (locale: string) => {
|
||||
const payload = await getCachedPayload()
|
||||
return payload.findGlobal({ slug: settingsSlug as never, depth: 2, locale: locale as never })
|
||||
return payload.findGlobal({ slug: settingsSlug as never, depth: 1, locale: locale as never })
|
||||
})
|
||||
|
||||
/** What does this URL point at? Routing only — no listing data. */
|
||||
|
||||
Reference in New Issue
Block a user