Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jumping forward and backward isn't stable and not completely seamless #120

Closed
MadLittleMods opened this issue Nov 2, 2022 · 0 comments · Fixed by #121
Closed

Jumping forward and backward isn't stable and not completely seamless #120

MadLittleMods opened this issue Nov 2, 2022 · 0 comments · Fixed by #121
Labels
A-archive-room-view The view to look at a room day by day in the archive T-Defect Something isn't working. Bugs, crashes, or other reported issues.

Comments

@MadLittleMods
Copy link
Contributor

MadLittleMods commented Nov 2, 2022

#114 mentioned "seamless navigation" with a caveat but jumping forward and backward in a normal room doesn't seem to land you in the same spot. And it's not obvious that you skipped over a couple messages in that gap either.

For example if I visit /r/test-room1:my.synapse.server/date/2021/12/09, jump to next, the jump back to previous, I'm now on /r/test-room1:my.synapse.server/date/2021/12/14.

This is caused because when we /messages?dir=f to jump forwards, the date picked is rounded to the end of the day and there are more messages in between than the limit. So we end up missing messages in the gap between the limit and where we jumped from.

Example:

  • Archive message limit: 6
  • Visit /r/foo:bar/date/<day1>: Will render from day 1 going backwards 6 messages (only 4 messages to show until we hit the start of the room)
  • Jump forwards, will go forward 6 messages and pick that timestamp to redirect to
  • /r/foo:bar/date/<day3>: Will render from day 3 going backwards 6 messages
1 <-- 2 <-- 3 <-- 4 <-- 5 <-- 6 <-- 7 <-- 8 <-- 9 <-- 10 <-- 11 <-- 12
[day 1            ]     [day 2            ]     [day 3               ]
[page1            ]
                  |------jump-forwards-6-messages----->|
                                    [page2                           ]
                   ﹍﹍﹍﹍﹍﹍﹍﹍﹍
                         gap

Potential solution

When jumping forwards (/messages?dir=f&limit=100), back track a bit until we can find a date boundary. This will guarantee some overlap with the previous page.

We then need to adjust the ?continue=top query parameter to take an event ID (?continue=$abc) to continue from so we can start the scroll off there.

Using the previous example, it would now look like this:

1 <-- 2 <-- 3 <-- 4 <-- 5 <-- 6 <-- 7 <-- 8 <-- 9 <-- 10 <-- 11 <-- 12
[day 1            ]     [day 2            ]     [day 3               ]
[page1            ]
                  |------jump forwards 6 messages----->|
                                          |<-backtrack-|
            [page2, start scroll at 5     ]
@MadLittleMods MadLittleMods added T-Defect Something isn't working. Bugs, crashes, or other reported issues. A-archive-room-view The view to look at a room day by day in the archive labels Nov 2, 2022
MadLittleMods added a commit that referenced this issue Nov 3, 2022
MadLittleMods added a commit that referenced this issue Nov 3, 2022
Fix #120
Follow-up to #114

 - Uses event permalinking (`?at=$xxx`) to continue the scroll where you should start reading again.
 - When we jump forwards, we make sure that we go a day back to ensure there isn't more than the page limit between where we jumped from and the day so we don't lose any messages in a gap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-archive-room-view The view to look at a room day by day in the archive T-Defect Something isn't working. Bugs, crashes, or other reported issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant