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
pull/10063/head jitsi-meet_6401
dimitardelchev93 3 years ago committed by GitHub
parent ace53c880b
commit 7936117fcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      react/features/speaker-stats/components/SpeakerStats.js
  2. 10
      react/features/speaker-stats/functions.js
  3. 2
      react/features/speaker-stats/reducer.js

@ -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)
};
}

@ -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());

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

Loading…
Cancel
Save