From 10ba5f8c3c8efc5642dc8684fa74f80a491e0500 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 13 Jun 2017 11:03:22 +0100 Subject: [PATCH] Only process user_directory response if it's for the current query --- src/components/views/dialogs/ChatInviteDialog.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index e331432228..9a14cb91d3 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -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);