From 4d2bd932a7d8a4421e0d7404cde01ba9f6876e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 25 Apr 2022 17:07:13 +0200 Subject: [PATCH] fix(lastN) fix last N getting stuck on 1 If last N goes down to 1 it will be stuck there since it's > 0 and will be our `lastNSelected`. When limits are applied we'll take the minimum, so it will end up being 1. Once can end up in last N being 1 by several means, the more obvious one by entering Picture-in-Picture mode on mobile. Fix it by not using the previous last N value for the current calculation, at all. Fixes: https://github.com/jitsi/jitsi-meet/issues/10257 Closes: https://github.com/jitsi/jitsi-meet/pull/10491 --- react/features/base/lastn/middleware.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/react/features/base/lastn/middleware.js b/react/features/base/lastn/middleware.js index a7aacfdc2..ad0d2876f 100644 --- a/react/features/base/lastn/middleware.js +++ b/react/features/base/lastn/middleware.js @@ -49,15 +49,14 @@ const _updateLastN = debounce(({ dispatch, getState }) => { const { appState } = state['features/background'] || {}; const { enabled: filmStripEnabled } = state['features/filmstrip']; const config = state['features/base/config']; - const { lastNLimits, lastN } = state['features/base/lastn']; + const { lastNLimits } = state['features/base/lastn']; const participantCount = getParticipantCount(state); - // Select the lastN value based on the following preference order. - // 1. The last-n value in redux. - // 2. The last-n value from 'startLastN' if it is specified in config.js - // 3. The last-n value from 'channelLastN' if specified in config.js. - // 4. -1 as the default value. - let lastNSelected = lastN || (config.startLastN ?? (config.channelLastN ?? -1)); + // Select the (initial) lastN value based on the following preference order. + // 1. The last-n value from 'startLastN' if it is specified in config.js + // 2. The last-n value from 'channelLastN' if specified in config.js. + // 3. -1 as the default value. + let lastNSelected = config.startLastN ?? (config.channelLastN ?? -1); // Apply last N limit based on the # of participants and config settings. const limitedLastN = limitLastN(participantCount, lastNLimits);