Skip to content

Commit

Permalink
fix: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed May 19, 2024
1 parent 77f2791 commit da1a7c8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const initialAppData = {
},
// by default off, so it will not appear in beam bots
[APP_DATA.caption]: false,
// {poll_id: [{skipped: boolean, option: number, options: number[]}]}
[APP_DATA.savedPollResponses]: {},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const TimedView = ({
const activeQuestion = poll.questions?.find(question => question.index === currentIndex);
const attemptedAll = (poll.questions?.length || 0) < currentIndex;

// Handles increments so only one question is shown at a time in quiz
useEffect(() => {
setCurrentIndex(getIndexToShow(localPeerResponses));
}, [localPeerResponses]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const Voting = ({ id, toggleVoting }: { id: string; toggleVoting: () => v
const fetchedInitialResponses = useRef(false);
const [savedPollResponses, setSavedPollResponses] = useSetAppDataByKey(APP_DATA.savedPollResponses);

// To reset whenever a different poll is opened
useEffect(() => {
fetchedInitialResponses.current = false;
}, [id]);
Expand All @@ -53,7 +54,6 @@ export const Voting = ({ id, toggleVoting }: { id: string; toggleVoting: () => v
return null;
}

// Skipping is not allowed yet
const updateSavedResponses = (questionIndex: number, option?: number, options?: number[]) => {
const savedPollResponsesCopy = { ...savedPollResponses };
savedPollResponsesCopy[questionIndex] = { option, options };
Expand Down

0 comments on commit da1a7c8

Please sign in to comment.