we are loading 500 to 600 images from parse server through ipfs image load is very low how to resolve
it could depend on the images, if the images are big then it could be a delay to download them, you can also try to load fewer images
how to do paggination in cloud code
how to load 10 images at time from cloud function
I don’t know what is the code that you are using now
Parse.Cloud.define("getArtwork", async (request) => {
const query = new Parse.Query("Artwork");
const queryResults = await query.find();
const results = [];
for (let i = 0; i < queryResults.length; ++i) {
results.push({
"cover": queryResults[i].attributes.cover,
"path": queryResults[i].attributes.path,
"tokenId": queryResults[i].attributes.nftId,
"tokenAddress": queryResults[i].attributes.tokenAddress,
"name": queryResults[i].attributes.name,
"description": queryResults[i].attributes.description,
"additionalInfo": queryResults[i].attributes.additionalInfo,
"unlockableContent": queryResults[i].attributes.unlockableContent,
"creator": queryResults[i].attributes.creator,
"fileType": queryResults[i].attributes.fileType,
"royalty": queryResults[i].attributes.royalty,
"active": queryResults[i].attributes.active,
"likes": queryResults[i].attributes.likes,
"currentOwner": queryResults[i].attributes.currentOwner,
"likers": queryResults[i].attributes.likers,
"category": queryResults[i].attributes.category,
"picReader": queryResults[i].attributes.picReader,
"imagedescription": queryResults[i].attributes.imagedescription,
"dectitle": queryResults[i].attributes.dectitle,
"benefit": queryResults[i].attributes.benefit,
"encouragements": queryResults[i].attributes.encouragements,
"encouragers": queryResults[i].attributes.encouragers
});
}
return results;
});
here is the cloud function how to use pagination here
inform us about the issue
it looks like it returns an array, you can change that behaviour to limit the results in multiple ways, you can also do it in front end
Parse.Cloud.define("getArtwork", async (request) => {
const query = new Parse.Query("Artwork");
const count = await query.count(); //ADDED THIS LINE
query.limit(count);
const queryResults = await query.find();
const results = [];
for (let i = 0; i < queryResults.length; ++i) {
results.push({
"cover": queryResults[i].attributes.cover,
"path": queryResults[i].attributes.path,
"tokenId": queryResults[i].attributes.nftId,
"tokenAddress": queryResults[i].attributes.tokenAddress,
"name": queryResults[i].attributes.name,
"description": queryResults[i].attributes.description,
"additionalInfo": queryResults[i].attributes.additionalInfo,
"unlockableContent": queryResults[i].attributes.unlockableContent,
"creator": queryResults[i].attributes.creator,
"fileType": queryResults[i].attributes.fileType,
"royalty": queryResults[i].attributes.royalty,
"active": queryResults[i].attributes.active,
"likes": queryResults[i].attributes.likes,
"currentOwner": queryResults[i].attributes.currentOwner,
"likers": queryResults[i].attributes.likers,
"category": queryResults[i].attributes.category,
"picReader": queryResults[i].attributes.picReader,
"imagedescription": queryResults[i].attributes.imagedescription,
"dectitle": queryResults[i].attributes.dectitle,
"benefit": queryResults[i].attributes.benefit,
"encouragements": queryResults[i].attributes.encouragements,
"encouragers": queryResults[i].attributes.encouragers
});
}
return results;
});
here our limit code is it getting more than 600 images at once so how can i load or do pagination to load 8 only at once time. we need to get all nft but only want to load 8 ,8,8
in front end you can show only 8 images
no we are showing 500 images but want to load 8 and then 8 but have loading issue it’s loading alll the 500 images from parse server cloud function
when you load them in front end, try to show only 8 of them from the entire list of 500
it getting the same time because it’s loading all the 500 images so load time issue which i am facing because it’s load all the 500 images from cloud code no issue with frontend
when I am showing the 8 item so load time is same still facing issue because it’s load all the 500 record at once from cloud code
what do you mean, you don’t even get the response from cloud code?
you could limit the query from cloud code to return only 8 results, you can use query.limit(8)
no i am getting the total 500 nft but want to load the nft quickly and is there any mechanism which will work to load the 8 nft and then other 8 nft
I think that you have to write some front end logic for that