diff --git a/src/routes/community/+page.svelte b/src/routes/community/+page.svelte index 6ee9b9af..5a8b266e 100644 --- a/src/routes/community/+page.svelte +++ b/src/routes/community/+page.svelte @@ -318,12 +318,13 @@ function updateVote(posts, postVote) { // Check if expand['alreadyVoted(post)'] exists if (!post.expand['alreadyVoted(post)']) { // Create the structure if it does not exist - post.expand['alreadyVoted(post)'] = [ + post['expand']['alreadyVoted(post)'] = [ { type: upvoteClicked ? 'upvote' : downvoteClicked ? 'downvote' : 'neutral', user: data?.user?.id } ]; + } else { // Update the existing type based on the click flags post.expand['alreadyVoted(post)'][0].type = upvoteClicked ? 'upvote' : downvoteClicked ? 'downvote' : 'neutral'; @@ -362,7 +363,6 @@ $: { $: { if(posts) { - console.log('caching saved') $cachedPosts = {"sortingPosts": sortingPosts,'currentPage': currentPage, 'seenPostId': seenPostId, 'posts': posts}; } } diff --git a/src/routes/community/post/[postId]/+page.svelte b/src/routes/community/post/[postId]/+page.svelte index 849f30f9..570cddd7 100644 --- a/src/routes/community/post/[postId]/+page.svelte +++ b/src/routes/community/post/[postId]/+page.svelte @@ -378,7 +378,7 @@ function updateVote(postVote) { // Check if expand['alreadyVoted(item)'] exists if (!item.expand['alreadyVoted(item)']) { // Create the structure if it does not exist - item.expand['alreadyVoted(post)'] = [ + item['expand']['alreadyVoted(post)'] = [ { type: upvoteClicked ? 'upvote' : downvoteClicked ? 'downvote' : 'neutral', user: data?.user?.id