|
@@ -1,4 +1,4 @@
|
|
-import React, { useState } from 'react';
|
|
|
|
|
|
+import React, { useState, useEffect } from 'react';
|
|
import styled from 'styled-components';
|
|
import styled from 'styled-components';
|
|
import Loading from '../../util/Loading';
|
|
import Loading from '../../util/Loading';
|
|
import GuessPane from "./GuessPane";
|
|
import GuessPane from "./GuessPane";
|
|
@@ -35,11 +35,15 @@ export default () => {
|
|
|
|
|
|
const [submitDisabled, setSubmitDisabled] = useState(false);
|
|
const [submitDisabled, setSubmitDisabled] = useState(false);
|
|
const [selectedPoint, setSelectedPoint] = useState(null);
|
|
const [selectedPoint, setSelectedPoint] = useState(null);
|
|
- const currentRound = useCurrentRound();
|
|
|
|
|
|
+ const finished = useCurrentRound() === null;
|
|
const targetPoint = useTargetPoint();
|
|
const targetPoint = useTargetPoint();
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ if (finished) {
|
|
|
|
+ dispatch.goToSummary();
|
|
|
|
+ }
|
|
|
|
+ }, [finished]);
|
|
|
|
|
|
- if (currentRound === null) {
|
|
|
|
- dispatch.goToSummary();
|
|
|
|
|
|
+ if (finished) {
|
|
return <Loading/>
|
|
return <Loading/>
|
|
}
|
|
}
|
|
|
|
|