BIGFIX: IPvGO tutorial was getting stuck if you left the tab and returned (#2071)

This commit is contained in:
Michael Ficocelli
2025-04-11 16:57:42 -04:00
committed by GitHub
parent 73dc9f2ef9
commit 376b561fed

View File

@@ -1,4 +1,4 @@
import React, { useRef, useState } from "react";
import React, { useRef, useState, useEffect, useCallback } from "react";
import { Typography, Button } from "@mui/material";
import { GoColor, GoValidity, ToastVariant } from "@enums";
@@ -65,12 +65,17 @@ export function GoTutorialChallenge({
}
};
const reset = () => {
const reset = useCallback(() => {
stateRef.current = getStateCopy(state);
stateRef.current.previousBoards = [];
setDisplayText(description);
setShowReset(false);
};
}, [state, description]);
// Ensure that the challenge is reset on unmount / mount
useEffect(() => {
reset();
}, [reset]);
return (
<div>