✨ feat: unify API options structure and enhance lookup handling across collections
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user