From 6740b6439f8d969cc8b88bb5003cc41d3367ffe8 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 4 Jun 2018 18:13:06 -0600 Subject: [PATCH] do not display content until after first fetch has completed --- .../dashboard/listing/dashboard_listing.js | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js index ef38ca524210b0..f7b9265960e753 100644 --- a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js +++ b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js @@ -55,6 +55,7 @@ export class DashboardListing extends React.Component { super(props); this.state = { + hasInitialFetchReturned: false, isFetchingItems: false, showDeleteModal: false, showLimitError: false, @@ -90,6 +91,7 @@ export class DashboardListing extends React.Component { // order than they were sent out. Only load results for the most recent search. if (filter === this.state.filter) { this.setState({ + hasInitialFetchReturned: true, isFetchingItems: false, dashboards: response.hits, totalDashboards: response.total, @@ -397,9 +399,9 @@ export class DashboardListing extends React.Component { renderListingOrEmptyState() { if (this.hasNoDashboards()) { return this.renderNoItemsMessage(); - } else { - return this.renderListing(); } + + return this.renderListing(); } renderListing() { @@ -446,13 +448,23 @@ export class DashboardListing extends React.Component { ); } + renderPageContent() { + if (!this.state.hasInitialFetchReturned) { + return; + } + + return ( + + {this.renderListingOrEmptyState()} + + ); + } + render() { return ( - - {this.renderListingOrEmptyState()} - + {this.renderPageContent()} );