diff --git a/client/src/AppRoot.tsx b/client/src/AppRoot.tsx index 43e4ae5..7f49912 100644 --- a/client/src/AppRoot.tsx +++ b/client/src/AppRoot.tsx @@ -52,6 +52,7 @@ export const configuredAtStorageKey = 'configuredAt' const AppRoot = ({ storage }: Props) => { const printBallotRef = useRef(null) + const [isFetchingElection, setIsFetchingElection] = useState(true) const getElection = async () => { const election = await storage.get(electionStorageKey) @@ -139,14 +140,13 @@ const AppRoot = ({ storage }: Props) => { useEffect(() => { ;(async () => { if (!election) { + setIsFetchingElection(true) const storageElection = await getElection() if (storageElection) { setElection(storageElection) setElectionHash(sha256(JSON.stringify(storageElection))) - setConfiguredAt((await storage.get(configuredAtStorageKey)) || '') } - if (castVoteRecordFiles === CastVoteRecordFiles.empty) { const storageCVRFiles = await getCVRFiles() if (storageCVRFiles) { @@ -154,6 +154,7 @@ const AppRoot = ({ storage }: Props) => { setIsOfficialResults((await getIsOfficialResults()) || false) } } + setIsFetchingElection(false) } })() }) @@ -197,6 +198,10 @@ const AppRoot = ({ storage }: Props) => { } } + if (isFetchingElection) { + return null + } + return (