Fixed some console errors with the search autocomplete when there are no suggestions to show
Этот коммит содержится в:
@@ -46,7 +46,7 @@ export default class SearchAutocomplete extends React.Component {
|
|||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
const content = $(ReactDOM.findDOMNode(this.refs.searchPopover)).find('.popover-content');
|
const content = $(ReactDOM.findDOMNode(this.refs.searchPopover)).find('.popover-content');
|
||||||
|
|
||||||
if (this.state.show) {
|
if (this.state.show && this.state.suggestions.length > 0) {
|
||||||
if (!prevState.show) {
|
if (!prevState.show) {
|
||||||
content.perfectScrollbar();
|
content.perfectScrollbar();
|
||||||
content.css('max-height', $(window).height() - 200);
|
content.css('max-height', $(window).height() - 200);
|
||||||
@@ -143,10 +143,12 @@ export default class SearchAutocomplete extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSelection() {
|
getSelection() {
|
||||||
if (this.state.mode === 'channels') {
|
if (this.state.suggestions.length > 0) {
|
||||||
return this.state.suggestions[this.state.selection].name;
|
if (this.state.mode === 'channels') {
|
||||||
} else if (this.state.mode === 'users') {
|
return this.state.suggestions[this.state.selection].name;
|
||||||
return this.state.suggestions[this.state.selection].username;
|
} else if (this.state.mode === 'users') {
|
||||||
|
return this.state.suggestions[this.state.selection].username;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user