You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const selectionSet = [
'id',
'title',
'content',
'tags.*',
] as const;
// this only returns the first 100 tags for each post
const listResult = await client.models.Post.list({
selectionSet,
});
// this also does not return all the objects
for (const post of listResult.data) {
// for each post we load the tags
const tagsPerPost = await client.models.Post.get(
{
id: post.id,
},
{
selectionSet: ['tags.*'] as const,
}
);
}
Describe the solution you'd like
const selectionSet = [
'id',
'title',
'content',
'tags.*',
] as const;
// this way the client would paginate and fetch all the tags until it reaches nextToken null
const listResult = await client.models.Post.list({
selectionSet,
fetchMode: {
tags: "ALL"
}
});
// or
const listResult = await client.models.Post.list({
selectionSet,
fetchMode: {
tags: {
limit: 1000
}
}
});
Describe alternatives you've considered
The alternative is to use, but then we loose the typing.
await client.graphql({
query: /* GraphQL */ `
...
Additional context
No response
Is this something that you'd be interested in working on?
👋 I may be able to implement this feature request
⚠️ This feature might incur a breaking change
The text was updated successfully, but these errors were encountered:
Is this related to a new or existing framework?
Next.js
Is this related to a new or existing API?
GraphQL API
Is this related to another service?
No response
Describe the feature you'd like to request
In amplify gen2 the eager load allows to fetch nested (one to many) objects. However it does not fetch all the related objects. It would be nice to allow the client to initiate a full load of the related objects. Or if it is possible then it is not mentioned here:
https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/#eagerly-load-a-has-many-relationship
Describe the solution you'd like
Describe alternatives you've considered
The alternative is to use, but then we loose the typing.
Additional context
No response
Is this something that you'd be interested in working on?
The text was updated successfully, but these errors were encountered: