From 5b6985fc5c19b1f00a9ff7fadf4da89b932ea1bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 20 Feb 2017 10:36:46 +0100 Subject: [PATCH] [RN] Fix use of undefined APP On RN we don't use the global APP object, so don't save the store there unless it's defined, which is the case in the current web version. Also, check for undefined explicitly, since a "if (!APP)" check will throw a ReferenceError. --- react/features/app/components/AbstractApp.js | 4 +++- react/features/base/conference/middleware.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.js index 7e1a0c25e6..6fbd2c3ef4 100644 --- a/react/features/app/components/AbstractApp.js +++ b/react/features/app/components/AbstractApp.js @@ -307,7 +307,9 @@ export class AbstractApp extends Component { // non-reactified parts of the code (conference.js for example). // Don't use in the react code!!! // FIXME: remove when the reactification is finished! - APP.store = store; + if (typeof APP !== 'undefined') { + APP.store = store; + } } return store; diff --git a/react/features/base/conference/middleware.js b/react/features/base/conference/middleware.js index 728b8c34fb..6aea2219fc 100644 --- a/react/features/base/conference/middleware.js +++ b/react/features/base/conference/middleware.js @@ -56,7 +56,7 @@ function _connectionEstablished(store, next, action) { // FIXME: workaround for the web version. Currently the creation of the // conference is handled by /conference.js - if (!APP) { + if (typeof APP === 'undefined') { store.dispatch(createConference()); }