From 3b245f01312bc447ad4dc327dd0c8e82c00acf1f Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 11 Dec 2015 03:22:44 +0000 Subject: [PATCH] discard stale search results --- src/components/structures/RoomView.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 1dc2440913..4c2bbfa8d1 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -459,6 +459,12 @@ module.exports = React.createClass({ } } }).then(function(data) { + + if (!self.state.searching || term !== self.refs.search_bar.refs.search_term.value) { + console.error("Discarding stale search results"); + return; + } + // for debugging: // data.search_categories.room_events.highlights = ["hello", "everybody"];