Skip to content

Commit

Permalink
do not display content until after first fetch has completed
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese authored and snide committed Jun 12, 2018
1 parent abdfbe6 commit 6740b64
Showing 1 changed file with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class DashboardListing extends React.Component {
super(props);

this.state = {
hasInitialFetchReturned: false,
isFetchingItems: false,
showDeleteModal: false,
showLimitError: false,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -446,13 +448,23 @@ export class DashboardListing extends React.Component {
);
}

renderPageContent() {
if (!this.state.hasInitialFetchReturned) {
return;
}

return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" className="dashboardLandingPage__content">
{this.renderListingOrEmptyState()}
</EuiPageContent>
);
}

render() {
return (
<EuiPage data-test-subj="dashboardLandingPage" className="dashboardLandingPage">
<EuiPageBody>
<EuiPageContent verticalPosition="center" horizontalPosition="center" className="dashboardLandingPage__content">
{this.renderListingOrEmptyState()}
</EuiPageContent>
{this.renderPageContent()}
</EuiPageBody>
</EuiPage>
);
Expand Down

0 comments on commit 6740b64

Please sign in to comment.