10 votes

Topic deleted by author

1 comment

  1. Deimos
    Link
    Thanks for the detailed explanation, I suspect I know where the problem's coming from, since it seems to be caused by going backwards through pages. This is kind of a confusing subject, but to...

    Thanks for the detailed explanation, I suspect I know where the problem's coming from, since it seems to be caused by going backwards through pages. This is kind of a confusing subject, but to reciprocate for writing it up in detail, let me try to explain what's probably causing it:

    Tildes uses a kind of "item-based" pagination, instead of "page-based". That is, you don't say something like "show me page 3", you say "show me the next page of items that comes after item X", where item X is the last one on the previous page.

    The reason to do it that way is because there are so many things that can add/remove items to a list or change the order of them that you can't really "trust" the page numbers to stay the same. For example, if there are 10 notifications per page, you would expect "show me page 3" to show you notifications #21-30. But if you cleared two of the notifications on page 2 before clicking Next, everything after them would have "moved up" by two positions, and you'd end up not seeing two notifications that were previously #21 and #22 but are now #19 and #20 and shouldn't be on page 3 any more.

    So to avoid that, you know that notification X was the last one on the page, and say "show me the next items after X". Their relative position hasn't changed compared to that item, so it works as you'd expect.

    When you're paging forward, it's simple. For something like notifications that are sorted by time, you just do "get the next 10 items, ordered by age, that are older than item X", and display them in the same order you fetch them - the first item on the page will be the "youngest" (closest to X's age) and the last item will be the oldest.

    But when you're paging backwards, it needs to be done a little differently. Since you're looking for the next set of items younger than X, they end up being fetched in the opposite order of how you want to display them (the first item fetched is the oldest, but it should be displayed last). So when you're paging forwards, you can display items in the same order they're fetched, but when you're paging backwards you need to display items in the opposite order.

    It sounds like that order-reversing went wrong in some way, and then of course everything else goes to hell if the first/last items are wrong, since everything's completely dependent on those. That it was "P1B" at the top of page 2 and not "P2B" is weird too, but it's probably all related.

    I'll take a look, thanks again for all the detail.

    8 votes