mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 11:21:41 +03:00
update upvote state inside post card
This commit is contained in:
parent
4032217c11
commit
db823b76f1
@ -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;
|
||||
|
||||
|
@ -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 = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user