Skip to content

Inconsistent pagination when new replies are created after page loadΒ #558

@palkerecsenyi

Description

@palkerecsenyi

Currently, we have an inconsistency with the replies pagination:

  1. User A loads the page, and sees a (parent) comment with 5 replies previewed, and a load more button for the remaining e.g. 25 replies.
  2. User A leaves the page open for 10 minutes before doing anything.
  3. User B leaves 3 new replies on the same comment that User A is viewing.
  4. User A clicks "load more". Because of User B's actions, all the existing replies that User A can see have been "shifted" up by 3 positions, but this change is not reflected on their page because we don't auto-reload replies.
  5. The load more button causes the next page to be loaded, which contains 3 existing comments that User A could already see, because they got shifted upwards. Therefore, duplicate comments are now visible.

This doesn't affect the parent timeline where we request the comments oldest-to-newest from the API. On the replies timeline, we request them newest-to-oldest, causing this problem with shifting. We don't support fully deleting a comment, so this problem cannot happen in the other direction.

A possible solution is to use OpenSearch's Point in Time feature, which is their officially recommended method of pagination. This involves creating a PIT (probably when the first timeline request is made upon page load) like so:

Image

This ID would be sent to the frontend or perhaps stored in the Flask session. We would then include it in any subsequent OpenSearch API requests, making it pretend as though we were searching in the past:

Image

This will probably need some changes on the invenio-records-resources level to allow adding the PIT ID to requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions