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(() => {
if (!leaderboard.loading) {
if (!leaderboard.error && leaderboard.data.length > 0) {
_formatRecommendedUsers(leaderboard.data);
const {loading, error, data} = leaderboard;
if (!loading) {
if (!error && data && data.length > 0) {
_formatRecommendedUsers(data);
}
}
}, [leaderboard]);
useEffect(() => {
if (!communities.loading) {
if (!communities.error && communities.data?.length > 0) {
_formatRecommendedCommunities(communities.data);
const {loading, error, data} = communities;
if (!loading) {
if (!error && data && data?.length > 0) {
_formatRecommendedCommunities(data);
}
}
}, [communities]);

View File

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