feat: unify API options structure and enhance lookup handling across collections

This commit is contained in:
2026-05-17 14:53:52 +00:00
parent f332c707b7
commit bd8d413850
10 changed files with 58 additions and 112 deletions
+6 -11
View File
@@ -126,19 +126,14 @@ Typical usage:
For repeated collection data such as galleries, teaser lists, or detail-page image arrays, also request the lookup instead of rendering from raw ID strings:
```ts
const entries = await getCachedEntries<CollectionName>(
"your-collection",
{ active: true },
"sortOrder",
undefined,
undefined,
undefined,
undefined,
"imageField:medialib"
)
const entries = await getCachedEntries<CollectionName>("your-collection", {
filter: { active: true },
sort: "sortOrder",
lookup: "imageField:medialib",
})
```
`getCachedEntries()` expects `lookup` as the 8th argument and as a string, not as part of the `params` object.
`getCachedEntries()` expects `lookup` as an option in the second arguments object.
Then consume the resolved entry from `_lookup`, for example `_lookup.imageField` or `_lookup.imageField?.[0]` depending on whether the schema stores one image or an array.