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
maybe:
collectPages would keep a map of
page => recordsand the return records could contain a collection of all records.if
pageis 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