summaryrefslogtreecommitdiffstats
path: root/webapp/components/more_channels.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/more_channels.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/more_channels.jsx')
-rw-r--r--webapp/components/more_channels.jsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/webapp/components/more_channels.jsx b/webapp/components/more_channels.jsx
index e4cff451d..d0b5f5399 100644
--- a/webapp/components/more_channels.jsx
+++ b/webapp/components/more_channels.jsx
@@ -107,17 +107,22 @@ export default class MoreChannels extends React.Component {
clearTimeout(this.searchTimeoutId);
- this.searchTimeoutId = setTimeout(
+ const searchTimeoutId = setTimeout(
() => {
searchMoreChannels(
term,
(channels) => {
+ if (searchTimeoutId !== this.searchTimeoutId) {
+ return;
+ }
this.setState({search: true, channels});
}
);
},
SEARCH_TIMEOUT_MILLISECONDS
);
+
+ this.searchTimeoutId = searchTimeoutId;
}
render() {
@@ -196,4 +201,4 @@ export default class MoreChannels extends React.Component {
MoreChannels.propTypes = {
onModalDismissed: React.PropTypes.func,
handleNewChannel: React.PropTypes.func
-}; \ No newline at end of file
+};