Feb 25, 2017 · 1 min read
The problem is the page model. The whole thing can be simplified if you forget the page model and adopt the “rolling window” model. In that model, you have a rolling window with a preset number of rows (or rows and columns if you’re in a grid) and the window can move up or down as long as there are more rows above it and below it. The bottom most row will always be 1 (or 0 if 0 indexed) and so you can’t move the window farther down that. The top is variable but always growing. Once an item has been added to the top the rolling window increments the top index and you can move the rolling window up by one row, or down, or by N rows in either direction where N is within the range defined by top and bottom.
