From 6dcb3f9dae563380cc7048e8f9c7dc52449749e1 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Thu, 14 Mar 2019 01:37:30 +0530 Subject: [PATCH] commandpalette: handle edge cases --- src/components/CommandPalette.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/CommandPalette.jsx b/src/components/CommandPalette.jsx index 96d2c33..69bc0dd 100644 --- a/src/components/CommandPalette.jsx +++ b/src/components/CommandPalette.jsx @@ -78,7 +78,7 @@ export class CommandPalette extends Component { }); return; } - if (e.which === ENTER_KEY) { + if (e.which === ENTER_KEY && this.state.list.length) { this.selectOption(this.state.list[this.state.selectedIndex]); } } @@ -118,6 +118,9 @@ export class CommandPalette extends Component { onKeyUp={this.keyDownHandler.bind(this)} style="width:100%" /> + {!this.props.files.length && !this.state.list.length ? ( +

Nothing to search here.

+ ) : null}