summaryrefslogtreecommitdiffstats
path: root/webapp/stores/suggestion_store.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-11-14 07:09:41 -0500
committerChristopher Speller <crspeller@gmail.com>2016-11-14 07:09:41 -0500
commit323ce8b203c570ed6a1dd57b44d6637ad8207616 (patch)
treeefc3c61b905244bdb0e1ace0ce9f5ae4876644ad /webapp/stores/suggestion_store.jsx
parentd1207d34c1d99eba9ebf85c98d267ee7e955ea7d (diff)
parentb55ec6148caa93d54b660afe55408c643d217108 (diff)
downloadchat-323ce8b203c570ed6a1dd57b44d6637ad8207616.tar.gz
chat-323ce8b203c570ed6a1dd57b44d6637ad8207616.tar.bz2
chat-323ce8b203c570ed6a1dd57b44d6637ad8207616.zip
Merge branch 'release-3.5'
Diffstat (limited to 'webapp/stores/suggestion_store.jsx')
-rw-r--r--webapp/stores/suggestion_store.jsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/webapp/stores/suggestion_store.jsx b/webapp/stores/suggestion_store.jsx
index 75221421f..39bea0b0c 100644
--- a/webapp/stores/suggestion_store.jsx
+++ b/webapp/stores/suggestion_store.jsx
@@ -121,6 +121,11 @@ class SuggestionStore extends EventEmitter {
}
addSuggestions(id, terms, items, component, matchedPretext) {
+ if (!this.getPretext(id).endsWith(matchedPretext)) {
+ // These suggestions are out of date since the pretext has changed
+ return;
+ }
+
const suggestion = this.suggestions.get(id);
suggestion.terms.push(...terms);
@@ -218,7 +223,7 @@ class SuggestionStore extends EventEmitter {
}
handleEventPayload(payload) {
- const {type, id, ...other} = payload.action; // eslint-disable-line no-use-before-define
+ const {type, id, ...other} = payload.action;
switch (type) {
case ActionTypes.SUGGESTION_PRETEXT_CHANGED:
@@ -243,6 +248,7 @@ class SuggestionStore extends EventEmitter {
this.emitSuggestionsChanged(id);
break;
case ActionTypes.SUGGESTION_CLEAR_SUGGESTIONS:
+ this.setPretext(id, '');
this.clearSuggestions(id);
this.clearSelection(id);
this.emitSuggestionsChanged(id);