Only process user_directory response if it's for the current query
This commit is contained in:
parent
35620311b3
commit
33f5d81d18
1 changed files with 5 additions and 0 deletions
|
@ -241,6 +241,11 @@ module.exports = React.createClass({
|
||||||
MatrixClientPeg.get().searchUserDirectory({
|
MatrixClientPeg.get().searchUserDirectory({
|
||||||
term: query,
|
term: query,
|
||||||
}).then((resp) => {
|
}).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);
|
this._processResults(resp.results, query);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('Error whilst searching user directory: ', err);
|
console.error('Error whilst searching user directory: ', err);
|
||||||
|
|
Loading…
Reference in a new issue