fix: realtime updates for room members and admins #178
Reference in New Issue
Block a user
Delete Branch "userAdityaa/flotilla:realtime-room-updates"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Fixes live updates for room/member/admin changes by ensuring active room is always subscribed and membership/admin state is derived correctly from snapshots and deltas.
Related to: #144
Test Steps:
Recordings
Two-part fix for room members, admins, and action items:
@hodlbod, does this approach look reasonable to you?
The sync changes look good, but I'm not so sure about core/state. I'm having a hard time telling what's changed there other than moving logic around. Is there anything in particular different functionality-wise?
The main real change in
core/stateis how membership is computed (a new functiongetMembershipStateis added). It now treats the full members event as a starting point and then applies later add/remove events on top, so member lists and pending join requests stay up to date in realtime.Other than that, most of the state diff is just reorganizing the logic.
Got it, would you mind making that change without reorganizing the logic? The new function takes too many parameters to be easy to understand. Smaller helper functions might be better, or just duplicate the logic everywhere it's needed.
Thanks @hodlbod for the feedback, I reworked this to keep the logic in place rather than routing it through the generic helper. The membership behavior change is still there, but the code now follows the original structure much more closely and avoids the extra abstraction.
Great, that's much clearer, thanks.
Now I'm going to ask you to go back again 😂. I think what we need here is a
getRoomMembers(url, h, events)function that can be called within deriveRoomMembers and deriveSpaceActionItems. I wouldn't mind agetSpaceMembers(url, events)function as well. That will be much clearer than putting both into the same function.I just created those 🥲, but then figured it’d be better to integrate them into the existing function. I’ll push the changes shortly.
@hodlbod I’ve added
getRoomMembersandgetSpaceMembershelpers, and now bothderiveRoomMembersandderiveSpaceActionItemsusegetRoomMembersdirectly.Let me know if you’d like any further tweaks!
190e9eb889to6fb5011830Looks great, thank you!