Fix infinite loading indicator when there are no entries.

master
Tom Hacohen 6 years ago
parent 9f4fb75d73
commit a8c6b30456

@ -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<PropsTypeInner> {
}
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 (<LoadingIndicator style={{display: 'block', margin: '40px auto'}} />);
}
@ -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,
};
};

Loading…
Cancel
Save