Giter VIP home page Giter VIP logo

Comments (3)

danielkurniadi avatar danielkurniadi commented on May 28, 2024

@rs can help me on this? Edge beta release will be greatly appreciated. I might be naive but it should be a simple feature in my opinion. Otherwise, can you suggest me how to work around with cursor base pagination with rs/rest-layer?

from rest-layer.

danielkurniadi avatar danielkurniadi commented on May 28, 2024

For now I was thinking the cursor based pagination can be achieved with filter greater than or lesser than.

However this means the client is forced to be aware on this pagination logic. It can be okay-ish if the design from beginning is to allow client / consumer to moderate pagination by specifying the filtering field + limit. But we have been following the strategy for pagination in Slack API Pagination such that if the fields used for this cursor changed in the Backend logic, Frontend or client doesn't need to care with the API changes. The result, yes might be different but the interface is still same.

from rest-layer.

smyrman avatar smyrman commented on May 28, 2024

Just to give a solution you can use today; you can use:

  • filter={id:{$lt:<last ID in response>}}. // or $gt, based on ordering.
  • sort=-id // or id
  • limit=<limit>

This can be implemented in client logic without any rest-layer changes. You can of course also combine the id filter with your own filter, e.g. using an outer $and to allow other filters on id.

This require the id field to be set as Sortable and Filterable. IF you use XIDs, they would be chronologically ordered based on create time.

PS! Iterating/sorting on other fields this way is possible, but require that the field is sortable, filterable AND unique (for the given filter).

from rest-layer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.