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.
pull/4568/head
Saúl Ibarra Corretgé 6 years ago committed by Saúl Ibarra Corretgé
parent 02e058370e
commit e0815de2ad
  1. 10
      react/features/welcome/components/WelcomePageSideBar.native.js

@ -44,12 +44,12 @@ type Props = {
/**
* Display name of the local participant.
*/
_displayName: string,
_displayName: ?string,
/**
* ID of the local participant.
*/
_localParticipantId: string,
_localParticipantId: ?string,
/**
* Sets the side bar visible or hidden.
@ -157,10 +157,12 @@ class WelcomePageSideBar extends Component<Props> {
*/
function _mapStateToProps(state: Object) {
const _localParticipant = getLocalParticipant(state);
const _localParticipantId = _localParticipant?.id;
const _displayName = _localParticipant && getParticipantDisplayName(state, _localParticipantId);
return {
_displayName: getParticipantDisplayName(state, _localParticipant.id),
_localParticipantId: _localParticipant.id,
_displayName,
_localParticipantId,
_visible: state['features/welcome'].sideBarVisible
};
}

Loading…
Cancel
Save