mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-24 05:42:33 +03:00
attempting to improve postcardContainer
This commit is contained in:
parent
3ccade57a6
commit
63f1c04633
@ -28,13 +28,14 @@ const PostCardContainer = ({
|
||||
isHideImage,
|
||||
nsfw,
|
||||
}) => {
|
||||
const [activeVotes, setActiveVotes] = useState([]);
|
||||
const [activeVotes, setActiveVotes] = useState(get(_content, 'active_votes', []));
|
||||
const [reblogs, setReblogs] = useState([]);
|
||||
const [_content, setContent] = useState(content);
|
||||
|
||||
//NOTE: potentially unnessacry fetch
|
||||
// useEffect(() => {
|
||||
// if (isRefresh) {
|
||||
// _fetchPost();
|
||||
// _fetchPost();
|
||||
// }
|
||||
// }, [isRefresh]);
|
||||
|
||||
@ -57,8 +58,8 @@ const PostCardContainer = ({
|
||||
};
|
||||
|
||||
if (_content) {
|
||||
setActiveVotes(get(_content, 'active_votes', []));
|
||||
setContent(_content);
|
||||
//no need to reset content here, it is already set
|
||||
// setContent(_content);
|
||||
fetchData(_content);
|
||||
}
|
||||
|
||||
@ -122,6 +123,7 @@ const PostCardContainer = ({
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
setContent(result);
|
||||
setActiveVotes(get(result, 'active_votes', []))
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
@ -136,8 +138,7 @@ const PostCardContainer = ({
|
||||
fetchPost={_fetchPost}
|
||||
content={_content || content}
|
||||
isHideImage={isHideImage}
|
||||
isNsfwPost={nsfw === '1'}
|
||||
activeVotes={activeVotes}
|
||||
isNsfwPost={nsfw || '1'}
|
||||
reblogs={reblogs}
|
||||
/>
|
||||
);
|
||||
|
@ -36,7 +36,6 @@ const PostCardView = ({
|
||||
fetchPost,
|
||||
isNsfwPost,
|
||||
intl,
|
||||
activeVotes,
|
||||
}) => {
|
||||
// const [rebloggedBy, setRebloggedBy] = useState(get(content, 'reblogged_by[0]', null));
|
||||
// const [activeVot, setActiveVot] = useState(activeVotes);
|
||||
@ -44,7 +43,6 @@ const PostCardView = ({
|
||||
// const [calcImgHeight, setCalcImgHeight] = useState(300);
|
||||
const calcImgHeight = 300;
|
||||
|
||||
|
||||
// Component Functions
|
||||
|
||||
const _handleOnUserPress = () => {
|
||||
|
@ -323,6 +323,7 @@ const PostsView = ({
|
||||
_onEndReachedCalledDuringMomentum = false;
|
||||
}}
|
||||
removeClippedSubviews
|
||||
//TODO: we can avoid 2 more rerenders by carefully moving these call to postsListContainer
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleOnRefreshPosts}
|
||||
onEndReachedThreshold={1}
|
||||
|
@ -514,7 +514,6 @@ export const getPost = async (author, permlink, currentUserName = null, isPromot
|
||||
try {
|
||||
console.log('Getting post: ', author, permlink);
|
||||
const post = await client.database.call('get_content', [author, permlink]);
|
||||
|
||||
return post ? parsePost(post, currentUserName, isPromoted) : null;
|
||||
} catch (error) {
|
||||
return error;
|
||||
|
Loading…
Reference in New Issue
Block a user