From a8c6b304569e828e71f73de2bc0f1c2bce5bf52e Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sat, 26 Jan 2019 22:46:48 +0000 Subject: [PATCH] Fix infinite loading indicator when there are no entries. --- src/SyncGate.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/SyncGate.tsx b/src/SyncGate.tsx index fc57efb..31ff931 100644 --- a/src/SyncGate.tsx +++ b/src/SyncGate.tsx @@ -36,6 +36,7 @@ type PropsTypeInner = RouteComponentProps<{}> & PropsType & { journals: JournalsType; entries: EntriesType; userInfo: UserInfoType; + fetchCount: number; }; const syncInfoSelector = createSelector( @@ -167,8 +168,9 @@ class SyncGate extends React.PureComponent { } if ((this.props.userInfo.value === null) || (journals === null) || - (entryArrays.size === 0) || - !entryArrays.every((x: any) => (x.value !== null))) { + ((this.props.fetchCount > 0) && + ((entryArrays.size === 0) || !entryArrays.every((x: any) => (x.value !== null)))) + ) { return (); } @@ -213,6 +215,7 @@ const mapStateToProps = (state: StoreState, props: PropsType) => { journals: state.cache.journals, entries: state.cache.entries, userInfo: state.cache.userInfo, + fetchCount: state.fetchCount, }; };