saberland/saber

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Lazy Load Pagination #191

krmax44 posted onGitHub

<!-- Please don't delete this template or we'll close your issue -->

<!-- Before creating an issue please make sure you are using the latest version of Saber. -->

Feature request

Currently, pagination for saber-plugin-query-posts is done by creating multiple static pages, each with different posts. It is not possible to only have one blog post page that loads more posts when you scroll to the bottom (or click a button, whatever).

<!-- Please ask questions via following several ways. -->

<!-- https://chat.saber.land/ -->

<!-- https://stackoverflow.com/questions/ask?tags=saberjs -->

What does the proposed API look like?

// Index.vue

async loadMorePosts() {
  this.currentPage++;
  const loadedPosts = await this.page.posts.loadPosts(this.currentPage);
  this.posts.push(loadedPosts);
}

How should this be implemented in your opinion?

By generating paginated json files that the client can request when needed.

Are you willing to work on this yourself?

Yes.


It's probably better to use saber-node.js for this:

  1. In onCreatePages hook, you can manually generate files /pages/1.json, /pages/2.json etc
  2. Use fetch in your app to request /pages/${page}.json.
posted by egoist over 5 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests