Skip to content

Provide a way to paginate #22

@NullVoxPopuli

Description

@NullVoxPopuli

maybe:

@tracked page = 1;

currentPage = findAll(this, 'posts', () => ({ page: this.page /* i don't know how this works exactly, depends on api, I guess? */ }));
records = collectPages(this, () => ({ page: this.page, records: this.currentPage.records }));

collectPages would keep a map of page => records and the return records could contain a collection of all records.
if page is ever set to a page that's already been visited, the set for that page will be re-set -- so your total list of data doesn't go stale.

If you wanted to avoid that request, you'd maybe want to track visited pages separate from records pages, so you can cache that way

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions