Browse Source

fix: better rare error handling

develop
Ezerous 4 years ago
parent
commit
e0f92a0765
  1. 2
      packages/concordia-app/src/views/Home/HomeTopicList/index.jsx
  2. 6
      packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx
  3. 6
      packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx
  4. 6
      packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx

2
packages/concordia-app/src/views/Home/HomeTopicList/index.jsx

@ -41,7 +41,7 @@ const HomeTopicList = () => {
useEffect(() => {
if (numTopicsResult) {
setNumTopics(parseInt(numTopicsResult.value, 10));
setNumTopics(parseInt(numTopicsResult.value, 10) || 0);
}
}, [numTopicsResult]);

6
packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx

@ -51,13 +51,15 @@ const ProfilePostList = (props) => {
useEffect(() => {
if (getUserPostCountResult) {
setUserPostCount(parseInt(getUserPostCountResult.value, 10));
setUserPostCount(parseInt(getUserPostCountResult.value, 10) || 0);
}
}, [getUserPostCountResult, userPostCount]);
useEffect(() => {
if (getUserPostsResult) {
setPostIds(getUserPostsResult.value.slice().reverse().map(Number));
const { value } = getUserPostsResult;
const res = value || [];
setPostIds(res.slice().reverse().map(Number));
}
}, [getUserPostsResult, userPostCount]);

6
packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx

@ -51,13 +51,15 @@ const ProfileTopicList = (props) => {
useEffect(() => {
if (getUserTopicCountResult) {
setUserTopicCount(parseInt(getUserTopicCountResult.value, 10));
setUserTopicCount(parseInt(getUserTopicCountResult.value, 10) || 0);
}
}, [getUserTopicCountResult, userTopicCount]);
useEffect(() => {
if (getUserTopicsResult) {
setTopicIds(getUserTopicsResult.value.slice().reverse().map(Number));
const { value } = getUserTopicsResult;
const res = value || [];
setTopicIds(res.slice().reverse().map(Number));
}
}, [getUserTopicsResult, userTopicCount]);

6
packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx

@ -49,13 +49,15 @@ const TopicPostList = (props) => {
useEffect(() => {
if (getTopicPostCountResult) {
setTopicPostCount(parseInt(getTopicPostCountResult.value, 10));
setTopicPostCount(parseInt(getTopicPostCountResult.value, 10) || 0);
}
}, [getTopicPostCountResult, topicPostCount]);
useEffect(() => {
if (getTopicPostsResult) {
setPostIds(getTopicPostsResult.value.slice().map(Number));
const { value } = getTopicPostsResult;
const res = value || [];
setPostIds(res.slice().map(Number));
}
}, [getTopicPostsResult, topicPostCount]);

Loading…
Cancel
Save