-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ElementCall: Use ViewRoom
dispatch action instead of react hoos to trigger call creation.
#29195
base: develop
Are you sure you want to change the base?
Conversation
820d813
to
b62cfca
Compare
56023ec
to
e07e7ba
Compare
ViewRoom
dispatch action instead of react hoos to trigger call creation.
In strict mode there is a call create -> destroy -> create infinite loop wen pressing the call button. This loop was a consequence of relying on component creation/destruction to handle creating and removing the call. This logic: - destroying a call if it was in the lobby but leaving it if it is connected when the user stops viewing the room the call belongs to. - Creating an ElementCall if there is not yet once when the user starts viewing a call. Belongs into the roomViewStore and not the components that are just a sideffect in the call livecycle. (view model separation)
656057d
to
2135918
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, few nits and a question
src/stores/RoomViewStore.tsx
Outdated
const currentRoomCall = this.state.roomId ? CallStore.instance.getCall(this.state.roomId) : null; | ||
if (payload.view_call && room) { | ||
if (!currentRoomCall) { | ||
ElementCall.create(room, false); | ||
} | ||
} | ||
// Destroy the call when leaving call view | ||
const prevRoomCall = this.state.roomId ? CallStore.instance.getCall(this.state.roomId) : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CallStore.instance.getCall(this.state.roomId)
is retuning a different call
on line 358 & 365 ?
Co-authored-by: Florian D <[email protected]>
We discussed this more internally and we will fix this in another planned refactor/feature eventually so I put this back into draft. |
fixes: #29196
In strict mode there is a call create -> destroy -> create infinite loop wen pressing the call button.
This loop was a consequence of relying on component creation/destruction to handle creating and removing the call.
This logic:
Belongs into the roomViewStore and not the components that are just a sideffect in the call livecycle. (view model separation)
One could argue that starting a call should not begin with dispatching a view call action to the roomViewStore but the dispatch should happen based on some intend but this PR wants to be a fix for the infinite loop in Strict mode and not a call livecycle refactor.
Checklist
public
/exported
symbols have accurate TSDoc documentation.