From ce08b736178fc51b53e0cfdf7685920af88b0cad Mon Sep 17 00:00:00 2001 From: David Meza Date: Mon, 23 Oct 2017 18:54:17 -0500 Subject: [PATCH] Fix problem with deeplinkingUrl still being set when preferences window closes. --- src/browser/components/MainPage.jsx | 10 +++++----- src/browser/index.jsx | 6 ++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/browser/components/MainPage.jsx b/src/browser/components/MainPage.jsx index 8036fc37..4786919e 100644 --- a/src/browser/components/MainPage.jsx +++ b/src/browser/components/MainPage.jsx @@ -23,15 +23,15 @@ const MainPage = createReactClass({ onTeamConfigChange: PropTypes.func.isRequired, initialIndex: PropTypes.number.isRequired, useSpellChecker: PropTypes.bool.isRequired, - onSelectSpellCheckerLocale: PropTypes.func.isRequired + onSelectSpellCheckerLocale: PropTypes.func.isRequired, + deeplinkingUrl: PropTypes.string }, getInitialState() { - const deeplinkingUrl = remote.getCurrentWindow().deeplinkingUrl; let key = this.props.initialIndex; - if (deeplinkingUrl !== null) { + if (this.props.deeplinkingUrl !== null) { for (var i = 0; i < this.props.teams.length; i++) { - if (deeplinkingUrl.includes(this.props.teams[i].url)) { + if (this.props.deeplinkingUrl.includes(this.props.teams[i].url)) { key = i; break; } @@ -274,7 +274,7 @@ const MainPage = createReactClass({ var isActive = self.state.key === index; let teamUrl = team.url; - const deeplinkingUrl = remote.getCurrentWindow().deeplinkingUrl; + const deeplinkingUrl = this.props.deeplinkingUrl; if (deeplinkingUrl !== null && deeplinkingUrl.includes(teamUrl)) { teamUrl = deeplinkingUrl; } diff --git a/src/browser/index.jsx b/src/browser/index.jsx index b31b1dad..7191af44 100644 --- a/src/browser/index.jsx +++ b/src/browser/index.jsx @@ -102,6 +102,11 @@ function handleSelectSpellCheckerLocale(locale) { const parsedURL = url.parse(window.location.href, true); const initialIndex = parsedURL.query.index ? parseInt(parsedURL.query.index, 10) : 0; +let deeplinkingUrl = null; +if (!parsedURL.query.index || parsedURL.query.index === null) { + deeplinkingUrl = remote.getCurrentWindow().deeplinkingUrl; +} + ReactDOM.render( , document.getElementById('content') );