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
@@ -104,6 +104,12 @@ fabryce i jest współdzielona — dlatego to fabryka, nie luźne funkcje. Bez t
|
||||
`cache()` nie dedupikowałby między helperami, a Next woła generateMetadata i
|
||||
komponent strony osobno.
|
||||
|
||||
`getSettings(locale)` czyta Site Settings z **`depth: 1`** — relacje (logo, strony w menu,
|
||||
strony systemowe) przychodzą jako dokumenty (`slug`, `title`), ale **ich** relacje już jako ID.
|
||||
Strona, którą `resolveRoute` renderuje (homepage, archiwum, zwykła strona), jest pobierana
|
||||
osobno z `depth: 2`. Potrzebujesz głębiej w layoucie (np. obraz strony podlinkowanej w menu)?
|
||||
Pobierz ten jeden dokument sam, zamiast podnosić głębokość całego globala na każdym żądaniu.
|
||||
|
||||
`resolveRoute` z fabryki przyjmuje `(locale, segments, page)` — rozstrzyga
|
||||
trasę. Pobranie wpisów to osobna funkcja `getEntries` (patrz niżej), bo
|
||||
routing i pobieranie danych to dwie różne odpowiedzialności.
|
||||
|
||||
Reference in New Issue
Block a user