flexyford / impagination

A lazy data layer for your paged records
102 stars 7 forks source link

`state.get(i)` returns the value at `i`, not the record at `i` #15

Closed cowboyd closed 8 years ago

cowboyd commented 8 years ago

If you have a record with the value "bob", you expect state.get(0) to return a record like:

{
  offset: 0
  isPending: false,
  isRejected false,
  isSettled: true,
  content: "bob"
}

Instead you see "bob"

flexyford commented 8 years ago

If that's the case then we can forget about returning state.pages since that's what we used to compute the page numbers in the color-demo. We can easily get the page numbers by using the Math.floor(record.offset / pageSize)

If, of course, we want to remove the notion of pages. It can wait for the time being.

flexyford commented 8 years ago

Fixed on #18