Second attempt at preventing "empty homepage" flash

The delay in fetching homepages causes the "empty homepage" splash to appear briefly for the authenticated case.

Part 2 of 61630930
This commit is contained in:
infinite-persistence 2022-03-31 22:32:13 +08:00 committed by Thomas Zarebczan
parent 8c7c1cfd5c
commit d482b2d35a
2 changed files with 5 additions and 2 deletions

View file

@ -5,7 +5,7 @@ import { doFetchActiveLivestreams } from 'redux/actions/livestream';
import { selectAdBlockerFound } from 'redux/selectors/app'; import { selectAdBlockerFound } from 'redux/selectors/app';
import { selectActiveLivestreams, selectFetchingActiveLivestreams } from 'redux/selectors/livestream'; import { selectActiveLivestreams, selectFetchingActiveLivestreams } from 'redux/selectors/livestream';
import { selectFollowedTags } from 'redux/selectors/tags'; import { selectFollowedTags } from 'redux/selectors/tags';
import { selectHasOdyseeMembership, selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectHasOdyseeMembership, selectHomepageFetched, selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectSubscriptions } from 'redux/selectors/subscriptions'; import { selectSubscriptions } from 'redux/selectors/subscriptions';
import { selectShowMatureContent, selectHomepageData, selectClientSetting } from 'redux/selectors/settings'; import { selectShowMatureContent, selectHomepageData, selectClientSetting } from 'redux/selectors/settings';
@ -17,6 +17,7 @@ const select = (state) => ({
authenticated: selectUserVerifiedEmail(state), authenticated: selectUserVerifiedEmail(state),
showNsfw: selectShowMatureContent(state), showNsfw: selectShowMatureContent(state),
homepageData: selectHomepageData(state), homepageData: selectHomepageData(state),
homepageFetched: selectHomepageFetched(state),
activeLivestreams: selectActiveLivestreams(state), activeLivestreams: selectActiveLivestreams(state),
fetchingActiveLivestreams: selectFetchingActiveLivestreams(state), fetchingActiveLivestreams: selectFetchingActiveLivestreams(state),
hideScheduledLivestreams: selectClientSetting(state, SETTINGS.HIDE_SCHEDULED_LIVESTREAMS), hideScheduledLivestreams: selectClientSetting(state, SETTINGS.HIDE_SCHEDULED_LIVESTREAMS),

View file

@ -33,6 +33,7 @@ type Props = {
subscribedChannels: Array<Subscription>, subscribedChannels: Array<Subscription>,
showNsfw: boolean, showNsfw: boolean,
homepageData: any, homepageData: any,
homepageFetched: boolean,
activeLivestreams: any, activeLivestreams: any,
doFetchActiveLivestreams: () => void, doFetchActiveLivestreams: () => void,
fetchingActiveLivestreams: boolean, fetchingActiveLivestreams: boolean,
@ -50,6 +51,7 @@ function HomePage(props: Props) {
authenticated, authenticated,
showNsfw, showNsfw,
homepageData, homepageData,
homepageFetched,
activeLivestreams, activeLivestreams,
doFetchActiveLivestreams, doFetchActiveLivestreams,
fetchingActiveLivestreams, fetchingActiveLivestreams,
@ -237,7 +239,7 @@ function HomePage(props: Props) {
</> </>
)} )}
{sortedRowData.length === 0 && authenticated && ( {sortedRowData.length === 0 && authenticated && homepageFetched && (
<div className="empty--centered"> <div className="empty--centered">
<Yrbl <Yrbl
alwaysShow alwaysShow