From 167ade0d597a0fe4c7b4b4696668fbfa6200a978 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 18 Oct 2022 23:23:52 -0400 Subject: [PATCH] fix: Flash of starred documents on Home screen --- app/components/PaginatedList.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/PaginatedList.tsx b/app/components/PaginatedList.tsx index bb0bca613..3f4911df2 100644 --- a/app/components/PaginatedList.tsx +++ b/app/components/PaginatedList.tsx @@ -54,6 +54,9 @@ class PaginatedList extends React.Component> { @observable isFetching = false; + @observable + isFetchingInitial = !this.props.items?.length; + @observable fetchCounter = 0; @@ -85,6 +88,7 @@ class PaginatedList extends React.Component> { this.allowLoadMore = true; this.renderCount = DEFAULT_PAGINATION_LIMIT; this.isFetching = false; + this.isFetchingInitial = false; this.isFetchingMore = false; }; @@ -112,6 +116,7 @@ class PaginatedList extends React.Component> { } this.renderCount += limit; + this.isFetchingInitial = false; } catch (err) { this.error = err; } finally { @@ -159,7 +164,7 @@ class PaginatedList extends React.Component> { const showLoading = this.isFetching && !this.isFetchingMore && - (!items?.length || this.fetchCounter === 0); + (!items?.length || (this.fetchCounter <= 1 && this.isFetchingInitial)); if (showLoading) { return (