From e6a7594d70dfde30e3dbb36d45e5d1458883553f Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Fri, 5 Feb 2016 09:47:43 -0500
Subject: Changed CommandProvider to only set the matched pretext if it
 actually matches anything

---
 web/react/utils/async_client.jsx | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

(limited to 'web/react/utils/async_client.jsx')

diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 328a7a7f2..c5957e8cc 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -789,14 +789,16 @@ export function getSuggestedCommands(command, suggestionId, component) {
             // pull out the suggested commands from the returned data
             const terms = matches.map((suggestion) => suggestion.suggestion);
 
-            AppDispatcher.handleServerAction({
-                type: ActionTypes.SUGGESTION_RECEIVED_SUGGESTIONS,
-                id: suggestionId,
-                matchedPretext: command,
-                terms,
-                items: matches,
-                component
-            });
+            if (terms.length > 0) {
+                AppDispatcher.handleServerAction({
+                    type: ActionTypes.SUGGESTION_RECEIVED_SUGGESTIONS,
+                    id: suggestionId,
+                    matchedPretext: command,
+                    terms,
+                    items: matches,
+                    component
+                });
+            }
         },
         (err) => {
             dispatchError(err, 'getCommandSuggestions');
-- 
cgit v1.2.3-1-g7c22

