diff --git a/src/components/postCard/container/postCardContainer.js b/src/components/postCard/container/postCardContainer.js index fe26e46e7..75b3e39f6 100644 --- a/src/components/postCard/container/postCardContainer.js +++ b/src/components/postCard/container/postCardContainer.js @@ -32,7 +32,7 @@ const PostCardContainer = ({ }) => { const [_content, setContent] = useState(content); const [reblogs, setReblogs] = useState([]); - const [activeVotes, setActiveVotes] = useState(get(_content, 'active_votes', [])); + const [activeVotes, setActiveVotes] = useState(get(content, 'active_votes', [])); //NOTE: potentially unnessacry fetch // useEffect(() => { @@ -41,6 +41,11 @@ const PostCardContainer = ({ // } // }, [isRefresh]); + useEffect(() => { + setContent(content); + setActiveVotes(get(content, 'active_votes', [])); + }, [content]); + useEffect(() => { let isCancelled = false; diff --git a/src/components/postCard/view/postCardView.js b/src/components/postCard/view/postCardView.js index a4d914670..d006a0761 100644 --- a/src/components/postCard/view/postCardView.js +++ b/src/components/postCard/view/postCardView.js @@ -43,6 +43,10 @@ const PostCardView = ({ const [activeVotesCount, setActiveVotesCount] = useState(activeVotes.length || 0); const [calcImgHeight, setCalcImgHeight] = useState(imageHeight || 300); + useEffect(() => { + setActiveVotesCount(activeVotes.length); + }, [activeVotes]); + // Component Functions const _handleOnUserPress = () => {