Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit a748778

Browse files
fix: added checks for obscure public/private mismatch
1 parent 753a787 commit a748778

File tree

1 file changed

+4
-4
lines changed
  • src/renderer/components/SearchResults

1 file changed

+4
-4
lines changed

src/renderer/components/SearchResults/Votes.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ const Votes = ({
3535
},
3636
});
3737

38-
const isUpVoted = Boolean(data?.votesData.isUpVoted);
39-
const isDownVoted = Boolean(data?.votesData.isDownVoted);
40-
const upVoteCount = Number(data?.votesData.upvotes);
41-
const downVoteCount = Number(data?.votesData.downvotes);
38+
const isUpVoted = Boolean(data?.votesData?.isUpVoted);
39+
const isDownVoted = Boolean(data?.votesData?.isDownVoted);
40+
const upVoteCount = Number(data?.votesData?.upvotes || upvotes);
41+
const downVoteCount = Number(data?.votesData?.downvotes || downvotes);
4242
const voteText = data ? upVoteCount - downVoteCount : upvotes - downvotes;
4343

4444
const [addVote] = useMutation<void, AddVoteMutationVariables>(ADD_VOTE);

0 commit comments

Comments
 (0)