diff --git a/src/components/views/directory/NetworkDropdown.js b/src/components/views/directory/NetworkDropdown.js index 3fcd8bb4..48d5152f 100644 --- a/src/components/views/directory/NetworkDropdown.js +++ b/src/components/views/directory/NetworkDropdown.js @@ -64,6 +64,12 @@ export default class NetworkDropdown extends React.Component { document.removeEventListener('click', this.onDocumentClick, false); } + componentDidUpdate() { + if (this.state.expanded && this.inputTextBox) { + this.inputTextBox.focus(); + } + } + onDocumentClick(ev) { // Close the dropdown if the user clicks anywhere that isn't // within our root element @@ -181,16 +187,8 @@ export default class NetworkDropdown extends React.Component { ; } - componentDidUpdate() { - if (this.state.expanded && this.inputTextBox) { - this.inputTextBox.focus(); - } - } - render() { - let current_value = this._makeMenuOption( - this.state.selectedServer, this.state.selectedNetwork, false - ); + let current_value; let menu; if (this.state.expanded) { @@ -201,6 +199,10 @@ export default class NetworkDropdown extends React.Component { current_value = + } else { + current_value = this._makeMenuOption( + this.state.selectedServer, this.state.selectedNetwork, false + ); } return