Merge pull request #2023 from ecency/nt/startup-crash-fix

NT - Startup Crash
This commit is contained in:
Feruz M 2021-08-05 18:40:05 +03:00 committed by GitHub
commit e263b397fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -59,17 +59,19 @@ const TabEmptyView = ({
useEffect(() => { useEffect(() => {
if (!leaderboard.loading) { const {loading, error, data} = leaderboard;
if (!leaderboard.error && leaderboard.data.length > 0) { if (!loading) {
_formatRecommendedUsers(leaderboard.data); if (!error && data && data.length > 0) {
_formatRecommendedUsers(data);
} }
} }
}, [leaderboard]); }, [leaderboard]);
useEffect(() => { useEffect(() => {
if (!communities.loading) { const {loading, error, data} = communities;
if (!communities.error && communities.data?.length > 0) { if (!loading) {
_formatRecommendedCommunities(communities.data); if (!error && data && data?.length > 0) {
_formatRecommendedCommunities(data);
} }
} }
}, [communities]); }, [communities]);

View File

@ -69,7 +69,7 @@ export default function (state = initialState, action) {
return { return {
...state, ...state,
communities: { communities: {
data: action.payload, data: action.payload || [],
loading: false, loading: false,
error: false, error: false,
}, },
@ -96,7 +96,7 @@ export default function (state = initialState, action) {
return { return {
...state, ...state,
subscribedCommunities: { subscribedCommunities: {
data: action.payload, data: action.payload || [],
loading: false, loading: false,
error: false, error: false,
}, },