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

Weird timeline API behaviour #3190

Open
4 tasks
ara4n opened this issue Mar 6, 2024 · 1 comment
Open
4 tasks

Weird timeline API behaviour #3190

ara4n opened this issue Mar 6, 2024 · 1 comment

Comments

@ara4n
Copy link
Member

ara4n commented Mar 6, 2024

I just had a go at implementing the timeline API in my experimental rust-sdk on Web test jig (aurora). I'm seeing very strange behaviour, which maps onto reported bugs on Element X. If I use the API via:

    let Ok(ui_room) = room_list_service.room(&id).await else {
        return Err(Error::Other(anyhow!("couldn't get room")));
    };

    let builder = match ui_room.default_room_timeline_builder().await {
        Ok(builder) => builder,
        Err(err) => {
            return Err(Error::Other(anyhow!("error when getting default timeline builder: {err}")));
        }
    };

    if let Err(err) = ui_room.init_timeline_with_builder(builder).await {
        return Err(Error::Other(anyhow!("error when creating default timeline: {err}")));
    }

    let (items, stream) = ui_room.timeline().unwrap().subscribe().await;

    // and then keep calling:
    let diff = stream.next().await.ok_or(anyhow!("no diffs"))?;

Then I get the following behaviour:

  • items returns an up-to-date array of date sep + the most recent ~6 items in the timeline, with unique_ids 0..6
  • diff then yields:
    • Clear (which deletes them all)
    • PushBack of the date sep (with unique_id 7)
    • PushBack of the most recent item in the timeline (with a new unique_id of 8, rather than 6 as it was before the clear)
    • then PushBacks of the previous 10 messages (meaning the timeline is now out of order), mixed with lots of Set as the items are gradually built up with RRs
    • then RemoveItem at index 1 to remove the out-of-order item
    • then PushBack to add it back (with unique_id 8) at the right point at the end.

In other words, the bugs are:

c.f. #1103 for known limitations of the timeline API, which doesn't look to include these.

@Hywan
Copy link
Member

Hywan commented Mar 13, 2024

The Clear is “normal“ because the server replies with a limited flag. With EventCache coming, we won't need to clear the timeline anymore.

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

No branches or pull requests

2 participants