diff --git a/src/pages/parts/admin/WorkerTestPart.tsx b/src/pages/parts/admin/WorkerTestPart.tsx index 274cbded..95118a8f 100644 --- a/src/pages/parts/admin/WorkerTestPart.tsx +++ b/src/pages/parts/admin/WorkerTestPart.tsx @@ -1,5 +1,5 @@ import classNames from "classnames"; -import { useEffect, useMemo, useState } from "react"; +import { useMemo, useState } from "react"; import { useAsyncFn } from "react-use"; import { singularProxiedFetch } from "@/backend/helpers/fetch"; @@ -54,7 +54,6 @@ export function WorkerTestPart() { const [buttonClicked, setButtonClicked] = useState(false); const [buttonDisabled, setButtonDisabled] = useState(false); - const [allWorkersPassed, setAllWorkersPassed] = useState(false); const [testState, runTests] = useAsyncFn(async () => { setButtonDisabled(true); @@ -90,7 +89,6 @@ export function WorkerTestPart() { status: "error", error: err as Error, }); - setAllWorkersPassed(false); // Set allWorkersPassed to false if a worker fails } }); @@ -98,12 +96,6 @@ export function WorkerTestPart() { setTimeout(() => setButtonDisabled(false), 5000); }, [workerList, setWorkerState]); - useEffect(() => { - setAllWorkersPassed( - workerState.every((worker) => worker.status === "success"), - ); - }, [workerState]); - return ( <> Worker tests @@ -128,18 +120,28 @@ export function WorkerTestPart() { })}
- {allWorkersPassed && buttonClicked ? ( -
-

All workers have passed the test! ٩(ˊᗜˋ*)و ♡

-
+ {buttonClicked ? ( + workerState.every((worker) => worker.status === "success") ? ( +

+ All workers have passed the test!{" "} + ٩(ˊᗜˋ*)و♡ +

+ ) : ( +

+ Some workers have failed the test...{" "} + (•᷄∩•᷅ ) +

+ ) ) : (