GatsbyCentral / gatsby-awesome-pagination

An opinionated, more awesome approach to pagination in Gatsby
MIT License
109 stars 27 forks source link

$skip and $limit #10

Closed Diogomartf closed 5 years ago

Diogomartf commented 5 years ago

I'm getting this error: Variable "$skip" of required type "Int!" was not provided. and same for $limit.

Everything is working fine except this. You can see the query bellow image

chmac commented 5 years ago

Can you add a debugger; call in that page's component to see what is passed into pageContext?

It looks like you're calling that template from somewhere that's not the pagination function, but I can't be sure. Is your code public?

Diogomartf commented 5 years ago

Thanks for the quick reply. It's not public.

image

Diogomartf commented 5 years ago

The query is on interviews-page.js

image gatsby-node.js image

chmac commented 5 years ago

The $skip and $limit are being correctly passed to the pageContext. I'd guess maybe you're calling createPage() somewhere else outside of the paginate() call?

If you can get me access to the code I could have a look in more detail. Unfortunately from what you've posted I can't see anything that looks like it would cause this issue.

chmac commented 5 years ago

I'm not sure it's related, but I think it's good practice to have a name before every query like query InterviewsPage(.... Don't know if that will change anything, but it's the only thing that I can see which seems out of place in your photos.

Diogomartf commented 5 years ago

I think it's not the case because as v2 of Gatsby query names are no longer required . I'll give you access to the code if you don't mind looking at it.

chmac commented 5 years ago

I saw your invite, took me a second to find the add-pagination branch. The problem is here at src/pages/entrevistas/index.md the templateKey means that you're loading that template without the pagination settings.

Hopefully that makes sense. If not, feel free to post again and I'll try to explain in more detail.

Diogomartf commented 5 years ago

You've nailed it. That was the issue. Thanks a lot @chmac