mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-20 03:42:10 +03:00
fixed local vote map duplication because of undefined post-id
This commit is contained in:
parent
3befe48910
commit
93c9ae86f2
@ -72,7 +72,7 @@ const UpvoteContainer = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const _handleLocalVote = () => {
|
const _handleLocalVote = () => {
|
||||||
const postId = get(content, 'post_id');
|
const postId = `${content.author || ''}-${content.permlink || ''}`;
|
||||||
const postFetchedAt = get(content, 'post_fetched_at', 0);
|
const postFetchedAt = get(content, 'post_fetched_at', 0);
|
||||||
const localVote = localVoteMap[postId] || null;
|
const localVote = localVoteMap[postId] || null;
|
||||||
if (localVote) {
|
if (localVote) {
|
||||||
@ -113,7 +113,7 @@ const UpvoteContainer = (props) => {
|
|||||||
|
|
||||||
setTotalPayout(totalPayout + amountNum);
|
setTotalPayout(totalPayout + amountNum);
|
||||||
//update redux
|
//update redux
|
||||||
const postId = get(content, 'post_id');
|
const postId = `${content.author || ''}-${content.permlink || ''}`;
|
||||||
const vote = {
|
const vote = {
|
||||||
votedAt: new Date().getTime(),
|
votedAt: new Date().getTime(),
|
||||||
amount: amountNum,
|
amount: amountNum,
|
||||||
|
@ -29,13 +29,22 @@ export const setOtherPosts = (posts, scrollPosition = 0) => ({
|
|||||||
},
|
},
|
||||||
type: SET_OTHER_POSTS,
|
type: SET_OTHER_POSTS,
|
||||||
});
|
});
|
||||||
export const updateLocalVoteMap = (postId, localVote) => ({
|
|
||||||
|
|
||||||
|
export const updateLocalVoteMap = (postId:string, localVote:{
|
||||||
|
votedAt: number,
|
||||||
|
amount: number,
|
||||||
|
isDownvote: boolean,
|
||||||
|
incrementStep: number
|
||||||
|
}) => ({
|
||||||
payload: {
|
payload: {
|
||||||
postId,
|
postId,
|
||||||
localVote,
|
localVote,
|
||||||
},
|
},
|
||||||
type: UPDATE_LOCAL_VOTE_MAP,
|
type: UPDATE_LOCAL_VOTE_MAP,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const resetLocalVoteMap = () => ({
|
export const resetLocalVoteMap = () => ({
|
||||||
type: RESET_LOCAL_VOTE_MAP,
|
type: RESET_LOCAL_VOTE_MAP,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user