Skip to content

Conversation

@robintown
Copy link
Member

@robintown robintown commented Oct 17, 2025

The execution of certain Observables related to a local or remote connection would continue even after we stopped caring about said connection because we were failing to give these state holders a proper ObservableScope of their own, separate from the CallViewModel's longer-lived scope. With this commit they now have scopes managed by a new helper function generateKeyed$.

Please take a look at the individual commits when reviewing. The first commit introduces a refactor that makes scope management less error-prone and makes generateKeyed$ possible to implement, the second one actually fixes the resource leaks, and the third is just an additional bit of test clean-up that the refactor enabled.

Previously we had a ViewModel class which was responsible for little more than creating an ObservableScope. However, since this ObservableScope would be created implicitly upon view model construction, it became a tad bit harder for callers to remember to eventually end the scope (as you wouldn't just have to remember to end ObservableScopes, but also to destroy ViewModels). Requiring the scope to be specified explicitly by the caller also makes it possible for the caller to reuse the scope for other purposes, reducing the number of scopes mentally in flight that need tending to, and for all state holders (not just view models) to be handled uniformly by helper functions such as generateKeyed$.
The execution of certain Observables related to a local or remote connection would continue even after we stopped caring about said connection because we were failing to give these state holders a proper ObservableScope of their own, separate from the CallViewModel's longer-lived scope. With this commit they now have scopes managed by generateKeyed$.
Copy link
Contributor

@toger5 toger5 left a comment

Choose a reason for hiding this comment

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

This looks good.

The generateKeyed$ also seems like an obvious candidate for the CallMembership static function on the RTCSession. (sadly this is js-sdk. But once we build our own rtc sdk that might be interesting again)

@robintown robintown merged commit 4936cdf into element-hq:voip-team/rebased-multiSFU Oct 21, 2025
14 of 17 checks passed
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.

2 participants