Fix MaxListenersExceededWarning (#7389)

pull/21833/head
Timo 2021-12-15 18:06:37 +01:00 committed by GitHub
parent 1c6a7646fa
commit d31aa12156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -658,6 +658,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
callState: callState,
});
CallHandler.instance.on(CallHandlerEvent.CallState, this.onCallState);
window.addEventListener('beforeunload', this.onPageUnload);
}
@ -675,7 +676,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
}
componentDidUpdate() {
CallHandler.instance.addListener(CallHandlerEvent.CallState, this.onCallState);
if (this.roomView.current) {
const roomView = this.roomView.current;
if (!roomView.ondrop) {
@ -769,6 +769,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
);
}
CallHandler.instance.off(CallHandlerEvent.CallState, this.onCallState);
// cancel any pending calls to the throttled updated
this.updateRoomMembers.cancel();