Parcourir la source

rn,welcome: fix accessing local participant

It need not always exist, since it's created asynchronousluy on app
initiualization. Make sure we are ready for it.

I've seen backtraces because of this.
master
Saúl Ibarra Corretgé il y a 6 ans
Parent
révision
e0815de2ad

+ 6
- 4
react/features/welcome/components/WelcomePageSideBar.native.js Voir le fichier

@@ -44,12 +44,12 @@ type Props = {
44 44
     /**
45 45
      * Display name of the local participant.
46 46
      */
47
-    _displayName: string,
47
+    _displayName: ?string,
48 48
 
49 49
     /**
50 50
      * ID of the local participant.
51 51
      */
52
-    _localParticipantId: string,
52
+    _localParticipantId: ?string,
53 53
 
54 54
     /**
55 55
      * Sets the side bar visible or hidden.
@@ -157,10 +157,12 @@ class WelcomePageSideBar extends Component<Props> {
157 157
  */
158 158
 function _mapStateToProps(state: Object) {
159 159
     const _localParticipant = getLocalParticipant(state);
160
+    const _localParticipantId = _localParticipant?.id;
161
+    const _displayName = _localParticipant && getParticipantDisplayName(state, _localParticipantId);
160 162
 
161 163
     return {
162
-        _displayName: getParticipantDisplayName(state, _localParticipant.id),
163
-        _localParticipantId: _localParticipant.id,
164
+        _displayName,
165
+        _localParticipantId,
164 166
         _visible: state['features/welcome'].sideBarVisible
165 167
     };
166 168
 }

Chargement…
Annuler
Enregistrer