You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm using gatsby-source-wordpress on my project.
I have a blog page, with a list of ten posts.
I also have a "load more" button at the end of this page, which will add ten posts each time it is triggered (some kind of manual infinite-scroll).
To get the 10 first posts, I use the standard page query which is triggered at build time (so that they are available for crawlers).
This is executed upon the gatsby-source-wordpress API (which differs from the public WPGraphQL API).
But when I click on the "load more" button, it has to execute a query upon the public WPGraphQL API (because the other one is not accessible on runtime).
So I have to specify the same query in two different formats to get things work.
And the pagination is not implemented the same way.
So I don't have any way to tell my second query where to start from.
The first one uses a page index system to handle pagination, and the second one uses a end cursor (some random ID).
When I run the first query (the one which is executed at build time), I can't get the endCursor, so I can't give any clue to my second query from where to start (because this second query only accepts an after input, which is the endCursor).
I haven't found anything on the web about this case.
I mean... I'm using Gatsby, Wordpress and an infinite scroll... it couldn't be more common.
I'm not the first one to do this combination I hope?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm using
gatsby-source-wordpress
on my project.I have a blog page, with a list of ten posts.
I also have a "load more" button at the end of this page, which will add ten posts each time it is triggered (some kind of manual infinite-scroll).
To get the 10 first posts, I use the standard page query which is triggered at build time (so that they are available for crawlers).
This is executed upon the
gatsby-source-wordpress
API (which differs from the public WPGraphQL API).But when I click on the "load more" button, it has to execute a query upon the public WPGraphQL API (because the other one is not accessible on runtime).
So I have to specify the same query in two different formats to get things work.
And the pagination is not implemented the same way.
In
gatsby-source-wordpress
, you can get this:But in WPGraphQL, you have this:
So I don't have any way to tell my second query where to start from.
The first one uses a page index system to handle pagination, and the second one uses a end cursor (some random ID).
When I run the first query (the one which is executed at build time), I can't get the
endCursor
, so I can't give any clue to my second query from where to start (because this second query only accepts anafter
input, which is theendCursor
).I haven't found anything on the web about this case.
I mean... I'm using Gatsby, Wordpress and an infinite scroll... it couldn't be more common.
I'm not the first one to do this combination I hope?
Beta Was this translation helpful? Give feedback.
All reactions