Hi pals. I’m not a seasoned GraphQL fella yet, so this one surprised me. Using GraphCMS, I was happily adding more content to my main datatype (‘artists’) when I noticed it wasn’t updating. After deciding it wasn’t caching etc, or anything at the GraphCMS end, I googled a little and found that GraphQL by default only supports 100 queries. Ha! Who knew. Everyone? Well I didn’t.
I thought maybe I needed to go and figure some sort of fix out for the Nuxt GraphCMS plugin I was using (some option that I would have to find but couldn’t; I even starting guessing what it might be…that’s never good…) but actually the answer was just a simple argument in the query.
So, instead of:
async asyncData({ $graphcms }) {
const { artists} = await $graphcms.request(
gql`
{
artists{
slug
title
id
}
`
);
return { artistbundle:artists};
},
Add (first:xxx) (xxx being the maxing-out number you want)
async asyncData({ $graphcms }) {
const { artists} = await $graphcms.request(
gql`
{
artists(first: 150) {
slug
title
id
}
`
);
return { artistbundle:artists};
},
Blam! Job done.
OKay before you start saying “everyone knows there’s a limit on GraphQL queries” or “read the docs” – I don’t know much…but I do know that what’s obvious to one person may not be obvious to someone else. You can’t know everything. So I hope that this helps someone else out there who felt pretty stupid with this one ๐
See you next time
Need rapid website development:
For smaller projects at high speed
-
Adding script tag embed to Gatsby component
Read More -
Get more than 100 queries in GraphQL (I felt stupid)
Read More -
Animate on Scroll (AOS) into Nuxt js
Read More -
WordPress Super-admin hack
Read More -
Add content or ACF field under thumbnail/image gallery in Woocommerce
Read More