Comments (1)
What about if we have a lot of posts, let's say more that 10k with 10 per page and the user arrives from google on one of our last, blog/page/900. How this will perform?
So, in this particular case, all the data is fetched up front and built into a static Gatsby site, so if the user visited /page/900
they would be looking at a static list of content. It would not be fetching from WordPress + WPGraphQL directly when the user is visiting the page, so performance for users would be great.
The downside is the build time, where if you wanted to add content to your site, it would need to re-build the entire site, which takes longer the more content there is, but the upside is the performance gains for the user.
We (folks at Gatsby) are working on ways for sites to be built incrementally, so potentially sooner than later, the site rebuilds might be minimal.
I saw that if we have no after and it's a /page/number and hasNextPage, we push data to allPosts and then get back to it to show page 900.
I am new to wp graphql so I'm not sure. If we have no after, there is now way for us to go straight to a specific page/offset, right?
Are there any plans for that?
I'm not 100% sure I follow here.
What the code here is doing is fetching all posts and storing them in the allPosts
array
Then, we iterate over that array and create the paginated lists here: https://github.com/wp-graphql/gatsby-wpgraphql-blog-example/blob/master/gatsby/createPosts.js#L43-L52
This allows us to see 10 posts on each page, for example:
https://gatsby-wpgraphql-blog-example.netlify.com/page/1
https://gatsby-wpgraphql-blog-example.netlify.com/page/2
https://gatsby-wpgraphql-blog-example.netlify.com/page/3
from gatsby-wpgraphql-blog-example.
Related Issues (4)
- Breaking words HOT 1
- Adding `isFrontPage` boolean to Pages data HOT 5
- Getting errors on build HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-wpgraphql-blog-example.