Skip to content

Commit

Permalink
fix: Fix speaker stats search dependency and remove duplicate logic j…
Browse files Browse the repository at this point in the history
…itsi#9751 (jitsi#10045)

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

* Fix speaker stats component render on update jitsi#9751
  • Loading branch information
dimitardelchev93 authored and carotkut94 committed Jan 6, 2022
1 parent eca9821 commit 7fea363
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
8 changes: 5 additions & 3 deletions react/features/speaker-stats/components/SpeakerStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -216,7 +216,8 @@ class SpeakerStats extends Component<Props> {
* @private
* @returns {{
* _localDisplayName: ?string,
* _stats: Object
* _stats: Object,
* _criteria: string,
* }}
*/
function _mapStateToProps(state) {
Expand All @@ -230,7 +231,8 @@ function _mapStateToProps(state) {
* @type {string|undefined}
*/
_localDisplayName: localParticipant && localParticipant.name,
_stats: getSpeakerStats(state)
_stats: getSpeakerStats(state),
_criteria: getSearchCriteria(state)
};
}

Expand Down
10 changes: 1 addition & 9 deletions react/features/speaker-stats/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand Down Expand Up @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion react/features/speaker-stats/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function _updateStats(state, { stats }) {
{},
state,
{
stats: finalStats,
stats: { ...finalStats },
pendingReorder: false
},
);
Expand Down

0 comments on commit 7fea363

Please sign in to comment.