diff --git a/apps/mark-scan/frontend/src/app_root.tsx b/apps/mark-scan/frontend/src/app_root.tsx index 6037d6ac6c..61598edb27 100644 --- a/apps/mark-scan/frontend/src/app_root.tsx +++ b/apps/mark-scan/frontend/src/app_root.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useReducer, useRef } from 'react'; +import React, { useCallback, useEffect, useReducer } from 'react'; import { ElectionDefinition, OptionalElectionDefinition, @@ -88,7 +88,6 @@ import { CastingBallotPage } from './pages/casting_ballot_page'; interface UserState { votes?: VotesDict; - showPostVotingInstructions?: boolean; } interface SharedState { @@ -128,7 +127,6 @@ export const blankBallotVotes: VotesDict = {}; const initialVoterState: Readonly = { votes: undefined, - showPostVotingInstructions: undefined, }; const initialSharedState: Readonly = { @@ -162,7 +160,7 @@ type AppAction = | { type: 'unconfigure' } | { type: 'updateVote'; contestId: ContestId; vote: OptionalVote } | { type: 'forceSaveVote' } - | { type: 'resetBallot'; showPostVotingInstructions?: boolean } + | { type: 'resetBallot' } | { type: 'enableLiveMode' } | { type: 'toggleLiveMode' } | { type: 'updatePollsState'; pollsState: PollsState } @@ -203,7 +201,6 @@ function appReducer(state: State, action: AppAction): State { return { ...state, ...initialVoterState, - showPostVotingInstructions: action.showPostVotingInstructions, }; case 'enableLiveMode': return { @@ -256,7 +253,6 @@ export function AppRoot({ reload, logger, }: Props): JSX.Element | null { - const PostVotingInstructionsTimeout = useRef(0); const [appState, dispatchAppState] = useReducer(appReducer, initialAppState); const { ballotsPrintedCount, @@ -264,7 +260,6 @@ export function AppRoot({ isLiveMode, pollsState, initializedFromStorage, - showPostVotingInstructions, votes, } = appState; @@ -367,7 +362,6 @@ export function AppRoot({ (newShowPostVotingInstructions?: boolean) => { dispatchAppState({ type: 'resetBallot', - showPostVotingInstructions: newShowPostVotingInstructions, }); history.push('/'); @@ -380,33 +374,6 @@ export function AppRoot({ [history, themeManager] ); - const hidePostVotingInstructions = useCallback(() => { - clearTimeout(PostVotingInstructionsTimeout.current); - endCardlessVoterSessionMutate(undefined, { - onSuccess() { - resetBallot(); - }, - }); - }, [endCardlessVoterSessionMutate, resetBallot]); - - // Hide Verify and Scan Instructions - useEffect(() => { - if (showPostVotingInstructions) { - PostVotingInstructionsTimeout.current = window.setTimeout( - hidePostVotingInstructions, - GLOBALS.BALLOT_INSTRUCTIONS_TIMEOUT_SECONDS * 1000 - ); - } - return () => { - clearTimeout(PostVotingInstructionsTimeout.current); - }; - /* We don't include hidePostVotingInstructions because it is updated - * frequently due to its dependency on auth, which causes this effect to - * run/cleanup,clearing the timeout. - */ - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [showPostVotingInstructions]); - const unconfigure = useCallback(async () => { await storage.clear();