Przeglądaj źródła

fix: Batch actions.

factor2
Hristo Terezov 2 lat temu
rodzic
commit
4aea40d34f

+ 8
- 4
react/features/speaker-stats/middleware.ts Wyświetl plik

@@ -1,3 +1,4 @@
1
+import { batch } from 'react-redux';
1 2
 import { AnyAction } from 'redux';
2 3
 
3 4
 import { IStore } from '../app/types';
@@ -49,11 +50,14 @@ MiddlewareRegistry.register(({ dispatch, getState }: IStore) => (next: Function)
49 50
             const stats = filterBySearchCriteria(state, speakerStats);
50 51
             const pendingReorder = getPendingReorder(state);
51 52
 
52
-            if (pendingReorder) {
53
-                dispatch(updateSortedSpeakerStatsIds(getSortedSpeakerStatsIds(state, stats) ?? []));
54
-            }
53
+            batch(() => {
54
+                if (pendingReorder) {
55
+                    dispatch(updateSortedSpeakerStatsIds(getSortedSpeakerStatsIds(state, stats) ?? []));
56
+                }
57
+
58
+                dispatch(updateStats(stats));
59
+            });
55 60
 
56
-            dispatch(updateStats(stats));
57 61
         }
58 62
 
59 63
         break;

+ 6
- 2
react/features/transcribing/middleware.ts Wyświetl plik

@@ -1,3 +1,5 @@
1
+import { batch } from 'react-redux';
2
+
1 3
 import {
2 4
     HIDDEN_PARTICIPANT_JOINED,
3 5
     HIDDEN_PARTICIPANT_LEFT,
@@ -64,8 +66,10 @@ MiddlewareRegistry.register(store => next => action => {
64 66
 
65 67
         if (potentialTranscriberJIDs.includes(participant.id)
66 68
             && participant.name === TRANSCRIBER_DISPLAY_NAME) {
67
-            store.dispatch(transcriberJoined(participant.id));
68
-            store.dispatch(hidePendingTranscribingNotification());
69
+            batch(() => {
70
+                store.dispatch(transcriberJoined(participant.id));
71
+                store.dispatch(hidePendingTranscribingNotification());
72
+            });
69 73
         }
70 74
 
71 75
         break;

Ładowanie…
Anuluj
Zapisz