summaryrefslogtreecommitdiffstats
path: root/webapp/components/channel_invite_modal.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-16 18:32:51 -0500
committerCorey Hulen <corey@hulen.com>2017-01-16 18:32:51 -0500
commit6b2c4a346ba9c50d533eadb2c64086d67d32c565 (patch)
tree2e4e7e17336419c4e464e08a7b365178ff4dab12 /webapp/components/channel_invite_modal.jsx
parent4257114a372fbe2d55178ecef303e4a251288015 (diff)
downloadchat-6b2c4a346ba9c50d533eadb2c64086d67d32c565.tar.gz
chat-6b2c4a346ba9c50d533eadb2c64086d67d32c565.tar.bz2
chat-6b2c4a346ba9c50d533eadb2c64086d67d32c565.zip
Discard outdated results in modal searches (#5082)
Diffstat (limited to 'webapp/components/channel_invite_modal.jsx')
-rw-r--r--webapp/components/channel_invite_modal.jsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/webapp/components/channel_invite_modal.jsx b/webapp/components/channel_invite_modal.jsx
index 355d23d53..5deec0794 100644
--- a/webapp/components/channel_invite_modal.jsx
+++ b/webapp/components/channel_invite_modal.jsx
@@ -117,19 +117,25 @@ export default class ChannelInviteModal extends React.Component {
clearTimeout(this.searchTimeoutId);
- this.searchTimeoutId = setTimeout(
+ const searchTimeoutId = setTimeout(
() => {
searchUsers(
term,
TeamStore.getCurrentId(),
{not_in_channel_id: this.props.channel.id},
(users) => {
+ if (searchTimeoutId !== this.searchTimeoutId) {
+ return;
+ }
+
this.setState({search: true, users});
}
);
},
Constants.SEARCH_TIMEOUT_MILLISECONDS
);
+
+ this.searchTimeoutId = searchTimeoutId;
}
render() {