mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-03 11:40:44 +03:00
added null checks for communities leaderboard data
This commit is contained in:
parent
2ef52f2292
commit
807174322a
@ -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]);
|
||||
|
@ -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,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user