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

Pin the timeline to a given event and paginate all the directions (permalink) #3234

Closed
8 of 12 tasks
bnjbvr opened this issue Mar 18, 2024 · 0 comments · Fixed by #3329
Closed
8 of 12 tasks

Pin the timeline to a given event and paginate all the directions (permalink) #3234

bnjbvr opened this issue Mar 18, 2024 · 0 comments · Fixed by #3329
Assignees

Comments

@bnjbvr
Copy link
Member

bnjbvr commented Mar 18, 2024

We want to support permalinks in the (UI) timeline of the Rust SDK, that is, the ability to click a link to an event, and navigate around it (in the past and future, i.e. backwards- and forward- paginate).

We do have some support for backwards pagination already in the event cache, so there's some previous work here. Here's how I see the next steps:

Part of #3058

Nice to have (deferred)

  • (nice to have) when clicking a permalink to an event that's "close by" (TBD), don't switch focus, but prepend events (until the focused event - N events)
  • (nice to have) another focus mode that's "latest unread" (= read marker)
  • (nice to have) make the paginator stateful object able to read events from the cache before spawning server queries
  • (nice to have, but not mandatory for this to happen) reconcile events received from a pagination with cached events.
    • Subsets of the problem to consider: no overlap (easy; throw away/keep in memory until there's some overlap after keeping on paginating), complete overlap (easy; do nothing — maybe replace pagination tokens), partial overlaps (intractable in the worst cases: what if we know A/B/C and receive A/D/C, as there's no way to figure the relative position of B and D — easy if there's linear overlap, aka A/B/C is known and we receive A/B/C/D or D/A/B/C).
@bnjbvr bnjbvr self-assigned this Mar 18, 2024
bnjbvr added a commit that referenced this issue Apr 12, 2024
This introduces a new helper object to run arbitrary pagination requests, backwards- or forward-. At the moment they're disconnected from the event cache, although I've put the files there for future convenience, since at some point we'll want to merge the retrieved events with the cache (? maybe).

This little state machine makes it possible to retrieve the initial data, given an initial event id, using the /context endpoint; then allow stateful pagination using a paginator kind of API. Paginating in the timeline indicates whether we've reached the start/end of the timeline.

The test for the state subscription is quite extensive and makes sure the basic functionality works as intended.

Some testing helpers have been (re)introduced in the SDK crate, simplifying the code, and introducing a better `EventFactory` / `EventBuilder` pattern than the existing one in the `matrix-sdk-test` crate. In particular, this can make use of some types in `matrix-sdk`, notably `SyncTimelineEvent` and `TimelineEvent`, and I've found the API to be simpler to use as well.

Part of #3234.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@bnjbvr and others