summaryrefslogtreecommitdiffstats
path: root/web/react/stores/suggestion_store.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/stores/suggestion_store.jsx')
-rw-r--r--web/react/stores/suggestion_store.jsx10
1 files changed, 6 insertions, 4 deletions
diff --git a/web/react/stores/suggestion_store.jsx b/web/react/stores/suggestion_store.jsx
index 8e64d02a3..5bd13b02d 100644
--- a/web/react/stores/suggestion_store.jsx
+++ b/web/react/stores/suggestion_store.jsx
@@ -223,11 +223,13 @@ class SuggestionStore extends EventEmitter {
this.emitSuggestionsChanged(id);
break;
case ActionTypes.SUGGESTION_RECEIVED_SUGGESTIONS:
- this.setMatchedPretext(id, other.matchedPretext);
- this.addSuggestions(id, other.terms, other.items, other.componentType);
+ if (other.matchedPretext === this.getMatchedPretext(id)) {
+ // ensure the matched pretext hasn't changed so that we don't receive suggestions for outdated pretext
+ this.addSuggestions(id, other.terms, other.items, other.component);
- this.ensureSelectionExists(id);
- this.emitSuggestionsChanged(id);
+ this.ensureSelectionExists(id);
+ this.emitSuggestionsChanged(id);
+ }
break;
case ActionTypes.SUGGESTION_SELECT_NEXT:
this.selectNext(id);