Skip to content

Commit 196c6ab

Browse files
committed
Fix stuck play button
1 parent 2cecfac commit 196c6ab

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

react_frontend/src/components/buttons/PlayPause.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const PlayPauseButton = ({
3535
const { warning, error, info, close } = useError();
3636
const codeRef = useRef("");
3737
const runningCodeRef = useRef("");
38-
const [state, setState] = useState<string>(CommsManager.getInstance().getState());
38+
const [state, setState] = useState<string>(
39+
CommsManager.getInstance().getState()
40+
);
3941
const [loading, setLoading] = useState<boolean>(false);
4042
const isCodeUpdatedRef = useRef<boolean | undefined>(undefined);
4143
const [isCodeUpdated, _updateCode] = useState<boolean | undefined>(false);
@@ -74,7 +76,6 @@ const PlayPauseButton = ({
7476
// App handling
7577

7678
const onAppStateChange = async (save?: boolean) => {
77-
7879
const manager = CommsManager.getInstance();
7980
setLoading(true);
8081

@@ -171,11 +172,15 @@ const PlayPauseButton = ({
171172
const base64data = reader.result; // Get the zip in base64
172173
// Send the base64 encoded blob
173174
if (base64data) {
174-
await manager.run(
175-
`/workspace/code/academy.${extension}`,
176-
toLint,
177-
base64data as string
178-
);
175+
try {
176+
await manager.run(
177+
`/workspace/code/academy.${extension}`,
178+
toLint,
179+
base64data as string
180+
);
181+
} catch (error) {
182+
setLoading(false);
183+
}
179184
console.log("Dockerized app started successfully");
180185
}
181186
};

0 commit comments

Comments
 (0)