I want get edges more than 50 items

I want get edges more than 50 items
No description
18 Replies
ngohongnguyen
ngohongnguyenOP3w ago
No description
ngohongnguyen
ngohongnguyenOP3w ago
I see this ( pageInfo) but dont have limit set for it
ngohongnguyen
ngohongnguyenOP3w ago
I try use first: 250
No description
ngohongnguyen
ngohongnguyenOP3w ago
and It''s not working
ljspoor94
ljspoor943w ago
You're not doing it the same as the documentation shows I suggest reading over the documentation again
ngohongnguyen
ngohongnguyenOP3w ago
thank for your answer. But I think you dont understand me. for now. for get all data. we need use ActionRun. But It's really bad for findMany example: // Fetch gallery images const [{ data: galleryImages, fetching: fetchingImages, error: errorImages }] = useFindMany(api.image, { first: 250, filter: { galleryId: { equals: id } }, sort: { position: "Ascending" }, select: { id: true, hotspots: { edges: { node: { id: true, } } }
} });
Chocci_Milk
Chocci_Milk3w ago
Hello, You can't get more than 50 records of a hasMany relationship. That is for performance reasons. If you want to get more records, you need to fetch the additional records with more calls. I believe that there's a page info on the hotspots level that you can use to get the next page of data (using endCursor)
ngohongnguyen
ngohongnguyenOP3w ago
yes. but we have 50 images. and I cant call api for it 🙁 Its really bad idea shopify support 250 for all edges 50 not enough
Chocci_Milk
Chocci_Milk3w ago
What you're doing inst calling the Shopify API, you're making a request to your Gadget database. The client that we give you doesn't support adding a first to nested model queries. You absolutely need to make additional requests to get more data for a related model Something like this (might have syntax errors):
const modelA = await api.modelA.findFirst({
select: {
modelBs: {
edges: {
node: {
id: true,
}
}
}
}
})

const additionalModelBs = await api.modelB.findMany({
after: modelA.modelBs.endCursor,
first: 250
})
const modelA = await api.modelA.findFirst({
select: {
modelBs: {
edges: {
node: {
id: true,
}
}
}
}
})

const additionalModelBs = await api.modelB.findMany({
after: modelA.modelBs.endCursor,
first: 250
})
ngohongnguyen
ngohongnguyenOP3w ago
its only for runAction not good for useFindMany I need use it for reactjs
Chocci_Milk
Chocci_Milk3w ago
What's your use case?
ngohongnguyen
ngohongnguyenOP3w ago
// Fetch gallery images const [{ data: galleryImages, fetching: fetchingImages, error: errorImages }] = useFindMany(api.image, { first: 250, filter: { galleryId: { equals: id } }, sort: { position: "Ascending" }, select: { id: true, hotspots: { edges: { node: { id: true, } } } } }); please check it help me my client have 68 hotspot
Chocci_Milk
Chocci_Milk3w ago
What are you trying to accomplish with the query?
ngohongnguyen
ngohongnguyenOP3w ago
and max hotspot is 50 my client have 68 hotspot items in image and with findMany. max hotspot only 50 items
Chocci_Milk
Chocci_Milk3w ago
I understand that but I'm trying to go deeper into the use case than that. I need to know exactly why you're trying to get the data all in one API call
ngohongnguyen
ngohongnguyenOP3w ago
i dont have another way. i have gallery id 1. I get gallery data 2. I have 250 images per gallery ( I need call another api ). 3. and I cant get 250 api hotspot for each image. Its why i need more than 50. ( Shopify support max 250)
Chocci_Milk
Chocci_Milk3w ago
What UI are you trying to display to the customer which requires that you make only one API call? We're not going to change the limit of the number of records we get in a nested model query so we have to find an alternative. If you better describe the use case, I can point you in the right direction

Did you find this page helpful?