MatrixAI/js-pagination

Enable optional query properties for pagination

Closed this issue · 1 comments

The seek, order, limit... etc should all be optional properties.

It's possible for there to be no properties to be used when you ask for a page.

Also the number of items could be empty. So seekFirst and seekLast would have to be undefined when the items is empty.

So they are also optional properties.

So to deal with the inevitable typing problems. Will have to use !. non-null assertion operator for this, since we have to indicate it must be fulfilled if the length is not empty.

This also means exposing a constructor for the pagination type itself and doing smart construction for this.

Also because Pagination is a POJO so we need to use https://dev.to/gcanti/functional-design-smart-constructors-14nb

Also the actions then have to take optional properties since fetching the pages can mean no query parameters at all.

This was resolved with the recent release of 1.0.0 and 1.0.1.