Heyo! I've run into an issue where a the elements of a relationship field gets paginated.
I have the collection
Lineups
which have an
Artists
relation (hasMany: true) field, however there are usually > 100 artists for each lineup.
When i request lineups through the REST api, the artists are automatically paginated to size 10.
I tried accessing the properties on artists on a lineups query by using
artists.limit=500
as a guess, but no luck.
Is there a way to paginate for nested values, or (preferably) set a higher limit for them? Do i have to use the GraphQL endpoint to fix this?
Thanks for any help!
What does the request you're making look like?
Querying lineups with GET
http://localhost:3000/api/lineups/{lineup_id}?depth=3
, which returns:
{
"id": "649011d4bab507b4315d8c66",
"artists": [
"648ffe81281ddf5744f8197c",
{+ 9 more IDs...}
],
"createdAt": "2023-06-19T08:29:08.340Z",
"updatedAt": "2023-06-19T08:29:08.340Z"
}
My (simplified) schema looks like this:
const Lineups: CollectionConfig = {
slug: 'lineups',
access: {
...
},
fields: [
{
name: 'name',
type: 'text',
required: true,
unique: true,
},
{
name: 'artists',
type: 'relationship',
relationTo: 'artistprofiles',
hasMany: true,
}
};
is this at all related to the relationship field issue you worked on recently?
No, I made some frontend changes but nothing on the backend where this bug seems to be located
FWIW I've noticed it behaves the same in the admin UI, I can only get 10 artists.
Opened an issue on github:
https://github.com/payloadcms/payload/issues/2885Thank you for making an issue for it. I think I have an understanding on what is going on. We'll get working on it so we can get a patch out, likely early next week.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.