From 4e1bbf27e301772a685db9b52c00f6a2cd1ebd32 Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Thu, 7 Dec 2017 15:13:01 -0500 Subject: [PATCH 1/2] Make sure to handle the rare case search results come back in a different order than retrieved --- .../listing/visualize_listing_table.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js b/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js index 22d7d6bcf993a..4ed9d1a56083e 100644 --- a/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js +++ b/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js @@ -52,15 +52,19 @@ export class VisualizeListingTable extends Component { this.debouncedFetch = _.debounce(filter => { this.props.fetchItems(filter) .then(items => { - this.setState({ - isFetchingItems: false, - selectedRowIds: [], - filter, - }); - this.items = items; - this.calculateItemsOnPage(); + // We need this check to handle the case where search results come back in a different + // order than they were sent out. Only load results for the most recent search. + if (filter === this.state.filter) { + this.setState({ + isFetchingItems: false, + selectedRowIds: [], + filter, + }); + this.items = items; + this.calculateItemsOnPage(); + } }); - }, 200); + }, 300); } componentWillUnmount() { From b30a6f82120d65b7599ecff397eaad1af87fcfdb Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Fri, 8 Dec 2017 09:43:25 -0500 Subject: [PATCH 2/2] Remove unnecessary setting of filter on the state --- .../kibana/public/visualize/listing/visualize_listing_table.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js b/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js index 4ed9d1a56083e..47f61bc0d5af9 100644 --- a/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js +++ b/src/core_plugins/kibana/public/visualize/listing/visualize_listing_table.js @@ -58,7 +58,6 @@ export class VisualizeListingTable extends Component { this.setState({ isFetchingItems: false, selectedRowIds: [], - filter, }); this.items = items; this.calculateItemsOnPage();