From c2c56737bfcf7251cfa66307b4b23abac702b78c Mon Sep 17 00:00:00 2001 From: enahum Date: Tue, 4 Jul 2017 20:45:12 -0400 Subject: [PATCH] RN-242 Fix race condition and ensure server url is set when tapping on a PN (#706) --- app/mattermost.js | 14 ++++++++++---- yarn.lock | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/mattermost.js b/app/mattermost.js index 3fbdca34e..d2765d846 100644 --- a/app/mattermost.js +++ b/app/mattermost.js @@ -203,6 +203,12 @@ export default class Mattermost { if (!notification.localNotification) { if (!state.views.root.appInitializing) { // go to notification if the app is initialized + + if (!Client4.getUrl()) { + // Make sure the Client has the server url set + Client4.setUrl(state.entities.general.credentials.url); + } + goToNotification(notification)(dispatch, getState); EventEmitter.emit(ViewTypes.NOTIFICATION_TAPPED); } else if (state.entities.general.credentials.token) { @@ -219,10 +225,6 @@ export default class Mattermost { }; startApp = (animationType = 'none') => { - if (!this.isConfigured) { - this.configurePushNotifications(); - } - Navigation.startSingleScreenApp({ screen: { screen: 'Root', @@ -234,5 +236,9 @@ export default class Mattermost { }, animationType }); + + if (!this.isConfigured) { + this.configurePushNotifications(); + } }; } diff --git a/yarn.lock b/yarn.lock index 2c777e9b8..923db5dbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3645,7 +3645,7 @@ makeerror@1.0.x: mattermost-redux@mattermost/mattermost-redux#master: version "0.0.1" - resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/92ed855365d0f014961fcd780a2d93762180ef5e" + resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/f996792ab8b1ab81ad0de76cf1a4f0a13c33a100" dependencies: deep-equal "1.0.1" harmony-reflect "1.5.1"