Selaa lähdekoodia

fix(features/notifications): crash on undefined participant

master
paweldomas 5 vuotta sitten
vanhempi
commit
14855f3255
1 muutettua tiedostoa jossa 3 lisäystä ja 2 poistoa
  1. 3
    2
      react/features/notifications/middleware.js

+ 3
- 2
react/features/notifications/middleware.js Näytä tiedosto

84
 
84
 
85
         const { id, role } = action.participant;
85
         const { id, role } = action.participant;
86
         const state = store.getState();
86
         const state = store.getState();
87
-        const { role: oldRole } = getParticipantById(state, id);
87
+        const oldParticipant = getParticipantById(state, id);
88
+        const oldRole = oldParticipant?.role;
88
 
89
 
89
-        if (oldRole !== role && role === PARTICIPANT_ROLE.MODERATOR) {
90
+        if (oldRole && oldRole !== role && role === PARTICIPANT_ROLE.MODERATOR) {
90
             const displayName = getParticipantDisplayName(state, id);
91
             const displayName = getParticipantDisplayName(state, id);
91
 
92
 
92
             store.dispatch(showNotification({
93
             store.dispatch(showNotification({

Loading…
Peruuta
Tallenna