we are currently migrating from Gatsby to a dynamically rendered page. We have a module in our system that allows the author to define some categories and tags, that are used to select which entries should be displayed. We use this module in one case to render all our news. Since we have quite some news, we need to paginate the module/page.
The problem is that we need to make multiple requests to contentful, as your API does not allow logical OR associations and requests including multiple content types, which makes pagination practically impossible.
On the first page we make the initial requests to get all the required entries. We merge the entries from the responses together, sort them somehow and send the first N entries to the frontend, where N is the defined page size. But what should we do when the user wants to see the second page? As our application is stateless and the all pages are deep linkable, we don’t know which entries were shown on the first page. We can’t simply define skip N in every request to contentful, as this would skip far to many entries. So we need to get the entries for the first page again, to compute the entries for the second page. This might even work for page 2 or 3, but this will fail very fast for higher pages. Getting all entries for the first 99 pages, to show page 100, kinda defeats the whole purpose of pagination…
So yes, there are workarounds, like using a common ordering criteria and implement something like infinity scroll, but sadly our client does not want a workaround. He want to have simple, plain old pagination that is deep linkable, especially for SEO.
Maybe we could change our content model so that we don’t need to query multiple content types, but we definitely need logical OR associations within one content type. I understand that this might lead to very expensive queries, but other systems have found a way to handle that too.
Are you guys planning to support this in the future?