fix: Fix speaker stats search dependency and remove duplicate logic #9751 (#10045)

* Fix speaker stats search dependency and remove duplicate logic #9751

* Fix speaker stats component render on update #9751
This commit is contained in:
dimitardelchev93 2021-09-29 06:17:49 +03:00 committed by GitHub
parent ace53c880b
commit 7936117fcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 13 deletions

View File

@ -10,7 +10,7 @@ import { connect } from '../../base/redux';
import { escapeRegexp } from '../../base/util';
import { initUpdateStats, initSearch } from '../actions';
import { SPEAKER_STATS_RELOAD_INTERVAL } from '../constants';
import { getSpeakerStats } from '../functions';
import { getSpeakerStats, getSearchCriteria } from '../functions';
import SpeakerStatsItem from './SpeakerStatsItem';
import SpeakerStatsLabels from './SpeakerStatsLabels';
@ -216,7 +216,8 @@ class SpeakerStats extends Component<Props> {
* @private
* @returns {{
* _localDisplayName: ?string,
* _stats: Object
* _stats: Object,
* _criteria: string,
* }}
*/
function _mapStateToProps(state) {
@ -230,7 +231,8 @@ function _mapStateToProps(state) {
* @type {string|undefined}
*/
_localDisplayName: localParticipant && localParticipant.name,
_stats: getSpeakerStats(state)
_stats: getSpeakerStats(state),
_criteria: getSearchCriteria(state)
};
}

View File

@ -2,7 +2,7 @@
import _ from 'lodash';
import { getLocalParticipant, getParticipantById, PARTICIPANT_ROLE } from '../base/participants';
import { getParticipantById, PARTICIPANT_ROLE } from '../base/participants';
import { objectSort } from '../base/util';
/**
@ -129,14 +129,6 @@ function getEnhancedStatsForOrdering(state, stats, orderConfig) {
for (const id in stats) {
if (stats[id].hasOwnProperty('_hasLeft') && !stats[id].hasLeft()) {
if (orderConfig.includes('name')) {
const localParticipant = getLocalParticipant(state);
if (stats[id].isLocalStats()) {
stats[id].setDisplayName(localParticipant.name);
}
}
if (orderConfig.includes('role')) {
const participant = getParticipantById(state, stats[id].getUserId());

View File

@ -96,7 +96,7 @@ function _updateStats(state, { stats }) {
{},
state,
{
stats: finalStats,
stats: { ...finalStats },
pendingReorder: false
},
);