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

Allow subscribing to RoomInfo updates #2411

Merged
merged 3 commits into from
Aug 25, 2023
Merged

Conversation

jplatte
Copy link
Collaborator

@jplatte jplatte commented Aug 15, 2023

Note to self: Probably should add a changelog entry.

@jplatte jplatte requested a review from a team as a code owner August 15, 2023 09:39
@jplatte jplatte requested review from Hywan and removed request for a team August 15, 2023 09:39
@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Patch coverage: 75.60% and project coverage change: -0.04% ⚠️

Comparison is base (8deb0ff) 77.33% compared to head (e6ab9b9) 77.29%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2411      +/-   ##
==========================================
- Coverage   77.33%   77.29%   -0.04%     
==========================================
  Files         183      183              
  Lines       19397    19399       +2     
==========================================
- Hits        15000    14995       -5     
- Misses       4397     4404       +7     
Files Changed Coverage Δ
crates/matrix-sdk-base/src/rooms/normal.rs 77.29% <72.97%> (-0.49%) ⬇️
...rates/matrix-sdk-ui/src/timeline/event_item/mod.rs 76.51% <100.00%> (ø)
...tes/matrix-sdk-ui/src/timeline/sliding_sync_ext.rs 83.33% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jplatte jplatte force-pushed the jplatte/room-info-observable branch from eb0a380 to 0262dd9 Compare August 15, 2023 10:34
Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. The idea is to get notified when RoomInfo has been updated, but we don't really know which part has been modified. I wonder if that would be desired to avoid unnecessary updates on the client-user-app side? And to clarify: yeah, knowing which part has been modified is difficult.

@stefanceriu
Copy link
Member

This works well client side but we do get a couple of extra updates whenever we enter a room. I wouldn't expect any updates when that happens 🤔

@jplatte jplatte force-pushed the jplatte/room-info-observable branch from 0262dd9 to 666a3f3 Compare August 17, 2023 17:51
bindings/matrix-sdk-ffi/src/room_info.rs Outdated Show resolved Hide resolved
@jplatte jplatte force-pushed the jplatte/room-info-observable branch from 666a3f3 to 17f055a Compare August 23, 2023 16:38
@jplatte jplatte requested a review from Hywan August 23, 2023 16:38
@jplatte jplatte force-pushed the jplatte/room-info-observable branch from 17f055a to e6ab9b9 Compare August 24, 2023 07:47
Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. One minor note.

Comment on lines +270 to +288
// Look for a local event in the `Timeline`.
//
// First off, let's see if a `Timeline` exists…
if let Some(timeline) = self.timeline.read().await.clone() {
// If it contains a `latest_event`…
if let Some(timeline_last_event) = timeline.latest_event().await {
// If it's a local echo…
if timeline_last_event.is_local_echo() {
return Ok(RoomInfo::new(
&self.inner,
Some(Arc::new(EventTimelineItem(timeline_last_event))),
)
.await?);
}
}
}

// Otherwise, fallback to the classical path.
let latest_event = match self.inner.latest_event() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is duplicated from matrix_sdk_ui::room_list_service::Room::latest_event. Don't you believe we can refactor to get this code in a single-place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be able to, but I think the latest event feature is going to transform a lot still before it will be done, so it's probably not worth it (especially as there are some small differences).

@Hywan
Copy link
Member

Hywan commented Aug 24, 2023

@jplatte Do you think it's just multiple updates, or a bug, in #2411 (comment)?

@jplatte
Copy link
Collaborator Author

jplatte commented Aug 24, 2023

Sounds like it might be a bug, but hard to tell. Doesn't sound like it's a problem outside of causing a bit of inefficiency though, so we could merge and investigate afterwards, right?

@jplatte
Copy link
Collaborator Author

jplatte commented Aug 24, 2023

Waiting on feedback from the next test run before merging either way though.

@Hywan
Copy link
Member

Hywan commented Aug 24, 2023

Sounds like it might be a bug, but hard to tell. Doesn't sound like it's a problem outside of causing a bit of inefficiency though, so we could merge and investigate afterwards, right?

Not ideal but I'm fine with that.

@stefanceriu
Copy link
Member

but I'm fine with that.

Yeah, I agree. It's fine. I'm going to try testing it soon, I promise 😁

@stefanceriu
Copy link
Member

Just tested it and apart from those 2 random updates at the begining it works great. I think we can merge it

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

Successfully merging this pull request may close these issues.

4 participants