#Loading data is way too long - Payload cloud

11 messages · Page 1 of 1 (latest)

unborn palm
brittle galleonBOT
unborn palm
#

Loading data is way too long - Payload cloud

ocean field
#

hey @unborn palm I can't say anything specific without additional details, but after quickly checking the request, it seems like depth is the issue. The posts seem to be rather large and since you got that "related posts" relationship attribute, for every post of the 100 that you're fetching with the default depth of 2, you're getting relatedPosts -> relatedPosts

#

If I'd have to fix this, I would

  1. implement pagination / infinity scroll and limit initial request to max 10
  2. Limit the depth to 1 (or 0 if possible), or build a custom aggregation endpoint to just retrieve the data you actually need
  3. Since you seem to be using next, use getStaticProps to fetch the data on build. Unless of course there's a specific reason why you're fetching the data live on the client?
#

Website looks awesome though!

unborn palm
#

hey @ocean field thanks for the feedback.

  1. yes pagination is something i need to take care
  2. without depth i dont have other information like author
  3. hm yes, i am doing that because of the categories which i am displaying and fetching by category

but in general getting the menu for example is also slow

#

and also there is sometimes an error "Error: Request failed with status code 504"

#

i didnt get it before few weeks

ocean field
#

Hmm, We’ve had this gateway timeout before, in our case it was an incorrect request in the backend which didn’t resolve correctly. I’d suggest that in your case it might be related to the huge query

#

If you need some additional info I’d go for a custom aggregation. I think at this point payload doesn’t support selective population