Only process user_directory response if it's for the current query

pull/21833/head
Luke Barnard 2017-06-13 11:03:22 +01:00
parent 701242a36b
commit 10ba5f8c3c
1 changed files with 5 additions and 0 deletions

View File

@ -241,6 +241,11 @@ module.exports = React.createClass({
MatrixClientPeg.get().searchUserDirectory({
term: query,
}).then((resp) => {
// The query might have changed since we sent the request, so ignore
// responses for anything other than the latest query.
if (this.state.query !== query) {
return;
}
this._processResults(resp.results, query);
}).catch((err) => {
console.error('Error whilst searching user directory: ', err);