Fix problem with deeplinkingUrl still being set when preferences window closes.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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(
|
||||
<MainPage
|
||||
teams={AppConfig.data.teams}
|
||||
@@ -110,6 +115,7 @@ ReactDOM.render(
|
||||
onTeamConfigChange={teamConfigChange}
|
||||
useSpellChecker={AppConfig.data.useSpellChecker}
|
||||
onSelectSpellCheckerLocale={handleSelectSpellCheckerLocale}
|
||||
deeplinkingUrl={deeplinkingUrl}
|
||||
/>,
|
||||
document.getElementById('content')
|
||||
);
|
||||
|
Reference in New Issue
Block a user