remove unused import / event listeners on unmount

This commit is contained in:
KDSBrowne 2021-04-19 11:18:34 +00:00
parent f46f7961e3
commit 35d07deb18

View File

@ -1,6 +1,5 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { findDOMNode } from 'react-dom';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import _ from 'lodash'; import _ from 'lodash';
import cx from 'classnames'; import cx from 'classnames';
@ -224,6 +223,15 @@ class BreakoutRoom extends PureComponent {
} }
} }
componentWillUnmount() {
if (this.listOfUsers) {
for(let i = 0; i < this.listOfUsers.children.length; i++) {
const roomList = this.listOfUsers.children[i].getElementsByTagName('div')[0];
roomList.removeEventListener('keydown', this.handleMoveEvent, true);
}
}
}
componentDidUpdate(prevProps, prevstate) { componentDidUpdate(prevProps, prevstate) {
if (this.listOfUsers) { if (this.listOfUsers) {
for(let i = 0; i < this.listOfUsers.children.length; i++) { for(let i = 0; i < this.listOfUsers.children.length; i++) {