Revert "fix(speaker-stats): reset hidden stats when clearing the criteria at unmount"

This reverts commit a6718572f8.
This commit is contained in:
Calinteodor 2022-02-01 16:52:42 +02:00 committed by GitHub
parent e814b365be
commit 1b7f6155f2
2 changed files with 3 additions and 32 deletions

View File

@ -170,24 +170,3 @@ export function filterBySearchCriteria(state: Object, stats: ?Object) {
return filteredStats; return filteredStats;
} }
/**
* Reset the hidden speaker stats.
*
* @param {Object} state - The redux state.
* @param {Object | undefined} stats - The unfiltered stats.
*
* @returns {Object} - Speaker stats.
* @public
*/
export function resetHiddenStats(state: Object, stats: ?Object) {
const resetStats = _.cloneDeep(stats ?? getSpeakerStats(state));
for (const id in resetStats) {
if (resetStats[id].hidden) {
resetStats[id].hidden = false;
}
}
return resetStats;
}

View File

@ -10,16 +10,16 @@ import { MiddlewareRegistry } from '../base/redux';
import { import {
INIT_SEARCH, INIT_SEARCH,
INIT_UPDATE_STATS, INIT_UPDATE_STATS
RESET_SEARCH_CRITERIA
} from './actionTypes'; } from './actionTypes';
import { initReorderStats, updateStats } from './actions'; import { initReorderStats, updateStats } from './actions';
import { filterBySearchCriteria, getSortedSpeakerStats, getPendingReorder, resetHiddenStats } from './functions'; import { filterBySearchCriteria, getSortedSpeakerStats, getPendingReorder } from './functions';
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
const result = next(action); const result = next(action);
switch (action.type) { switch (action.type) {
case INIT_SEARCH: { case INIT_SEARCH: {
const state = getState(); const state = getState();
const stats = filterBySearchCriteria(state); const stats = filterBySearchCriteria(state);
@ -38,14 +38,6 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
dispatch(updateStats(pendingReorder ? getSortedSpeakerStats(state, stats) : stats)); dispatch(updateStats(pendingReorder ? getSortedSpeakerStats(state, stats) : stats));
} }
break; break;
case RESET_SEARCH_CRITERIA: {
const state = getState();
const stats = resetHiddenStats(state);
dispatch(updateStats(stats));
break;
}
case PARTICIPANT_JOINED: case PARTICIPANT_JOINED:
case PARTICIPANT_LEFT: case PARTICIPANT_LEFT:
case PARTICIPANT_KICKED: case PARTICIPANT_KICKED: