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,
|
onTeamConfigChange: PropTypes.func.isRequired,
|
||||||
initialIndex: PropTypes.number.isRequired,
|
initialIndex: PropTypes.number.isRequired,
|
||||||
useSpellChecker: PropTypes.bool.isRequired,
|
useSpellChecker: PropTypes.bool.isRequired,
|
||||||
onSelectSpellCheckerLocale: PropTypes.func.isRequired
|
onSelectSpellCheckerLocale: PropTypes.func.isRequired,
|
||||||
|
deeplinkingUrl: PropTypes.string
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
const deeplinkingUrl = remote.getCurrentWindow().deeplinkingUrl;
|
|
||||||
let key = this.props.initialIndex;
|
let key = this.props.initialIndex;
|
||||||
if (deeplinkingUrl !== null) {
|
if (this.props.deeplinkingUrl !== null) {
|
||||||
for (var i = 0; i < this.props.teams.length; i++) {
|
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;
|
key = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -274,7 +274,7 @@ const MainPage = createReactClass({
|
|||||||
var isActive = self.state.key === index;
|
var isActive = self.state.key === index;
|
||||||
|
|
||||||
let teamUrl = team.url;
|
let teamUrl = team.url;
|
||||||
const deeplinkingUrl = remote.getCurrentWindow().deeplinkingUrl;
|
const deeplinkingUrl = this.props.deeplinkingUrl;
|
||||||
if (deeplinkingUrl !== null && deeplinkingUrl.includes(teamUrl)) {
|
if (deeplinkingUrl !== null && deeplinkingUrl.includes(teamUrl)) {
|
||||||
teamUrl = deeplinkingUrl;
|
teamUrl = deeplinkingUrl;
|
||||||
}
|
}
|
||||||
|
@@ -102,6 +102,11 @@ function handleSelectSpellCheckerLocale(locale) {
|
|||||||
const parsedURL = url.parse(window.location.href, true);
|
const parsedURL = url.parse(window.location.href, true);
|
||||||
const initialIndex = parsedURL.query.index ? parseInt(parsedURL.query.index, 10) : 0;
|
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(
|
ReactDOM.render(
|
||||||
<MainPage
|
<MainPage
|
||||||
teams={AppConfig.data.teams}
|
teams={AppConfig.data.teams}
|
||||||
@@ -110,6 +115,7 @@ ReactDOM.render(
|
|||||||
onTeamConfigChange={teamConfigChange}
|
onTeamConfigChange={teamConfigChange}
|
||||||
useSpellChecker={AppConfig.data.useSpellChecker}
|
useSpellChecker={AppConfig.data.useSpellChecker}
|
||||||
onSelectSpellCheckerLocale={handleSelectSpellCheckerLocale}
|
onSelectSpellCheckerLocale={handleSelectSpellCheckerLocale}
|
||||||
|
deeplinkingUrl={deeplinkingUrl}
|
||||||
/>,
|
/>,
|
||||||
document.getElementById('content')
|
document.getElementById('content')
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user