Skip to content

Commit

Permalink
oops bug with onClick
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Donham committed Apr 29, 2022
1 parent 3787949 commit 776c74a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/blocks/file-blocks/poll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export default function (props: FileBlockProps) {

const onClick = (index: number) => {
if (!isEditable) return;
const newPoll = { ...poll };
newPoll.options[index].votes += 1;
onUpdateContent(JSON.stringify(newPoll));
return () => {
const newPoll = { ...poll };
newPoll.options[index].votes += 1;
onUpdateContent(JSON.stringify(newPoll));
};
};

if (!poll || !poll.options)
Expand Down

0 comments on commit 776c74a

Please sign in to comment.