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

Start refactoring some business logic into view models #1969

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

robintown
Copy link
Member

I'm using this PR to get a non-broken Netlify build

As Element Call grows in complexity, it has become a pain point that our business logic remains so tightly coupled to the UI code. In particular, this has made testing difficult, and the complex semantics of React hooks are not a great match for arbitrary business logic. Here, I show the beginnings of what it would look like for us to adopt the MVVM pattern. I've created a CallViewModel and TileViewModel that expose their state to the UI as rxjs Observables, as well as a couple of helper functions for consuming view models in React code.

This should contain no user-visible changes, but we need to watch out for regressions particularly around focus switching and promotion of speakers, because this was the logic I chose to refactor first.
@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (445c7c4) 24.67% compared to head (169ccd9) 24.67%.

Additional details and impacted files
@@           Coverage Diff            @@
##           livekit    #1969   +/-   ##
========================================
  Coverage    24.67%   24.67%           
========================================
  Files           48       48           
  Lines         2383     2383           
  Branches       438      438           
========================================
  Hits           588      588           
  Misses        1744     1744           
  Partials        51       51           
Flag Coverage Δ
unittests 24.67% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

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